#!/usr/bin/env python
import sys, stat, urllib, mimetypes, posixpath, time, webbrowser
+import urllib
from bup import options, git, vfs
from bup.helpers import *
try:
if path != "/":
yield('..', '../' + url_append, '')
for sub in n:
- display = link = sub.name
+ display = sub.name
+ link = urllib.quote(sub.name)
# link should be based on fully resolved type to avoid extra
# HTTP redirect.
if stat.S_ISDIR(sub.try_resolve().mode):
- link = sub.name + "/"
+ link += "/"
if not show_hidden and len(display)>1 and display.startswith('.'):
continue
size = None
if stat.S_ISDIR(sub.mode):
- display = sub.name + '/'
+ display += '/'
elif stat.S_ISLNK(sub.mode):
- display = sub.name + '@'
+ display += '@'
else:
size = sub.size()
size = (opt.human_readable and format_filesize(size)) or size
+{% comment This template expects the default xhtml autoescaping. %}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</tr>
{% for (display, link, size) in dir_contents %}
<tr>
- <td class="dir-name"><a href="{{ link }}">{{ display }}</a></td>
+ <td class="dir-name">
+ <a href="{% raw link %}">{{ display }}</a>
+ </td>
<td class="dir-size">{% if size != None %}{{ size }}{% else %} {% end %}</td>
</tr>
{% end %}