Quote filenames in several places.
Thu Feb 23 18:51:21 UTC 2006 Alberto Bertogli <albertogli@telpin.com.ar>
* Quote filenames in several places.
There were several places using filenames in URLs without quoting them
properly, this fixes them.
Thanks to VMiklos for the report.
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2015-11-19 06:09:07.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2015-11-19 06:09:08.000000000 +0000
@@ -355,6 +355,7 @@
""" % { "myreponame": config.myreponame, 'hash': h }
realf = realpath(f)
+ f = urllib.quote(f)
if f and h:
print """
@@ -1607,12 +1608,13 @@
print """
<td>
<a class="list" href="%(myreponame)s;a=filediff;h=%(hash)s;f=%(file)s">
- %(file)s</a>
+ %(fname)s</a>
</td>
""" % {
'myreponame': config.myreponame,
'hash': p.hash,
- 'file': f
+ 'file': urllib.quote(f),
+ 'fname': escape(f),
}
else:
print "<td>%s</td>" % f
@@ -1662,7 +1664,7 @@
""" % {
'myreponame': config.myreponame,
'hash': p.hash,
- 'file': f
+ 'file': urllib.quote(f)
}
print '</tr>'
print '</table>'
@@ -1687,7 +1689,7 @@
if not p: continue
sofar += '/' + p
print '<a href="%s;a=tree;f=%s">%s</a> /' % \
- (config.myreponame, escape(sofar), p)
+ (config.myreponame, urllib.quote(sofar), p)
print """
</b></div>
@@ -1721,20 +1723,21 @@
print '<tr class="light">'
alt = not alt
realfile = path + f
+ fullf = filter_file(dname + '/' + f)
print '<td style="font-family:monospace">', fperms(realfile),
print '</td>'
if f in dlist:
print """
- <td><a class="list" href="%(myrname)s;a=tree;f=%(newf)s">%(f)s</a></td>
+ <td><a class="list" href="%(myrname)s;a=tree;f=%(fullf)s">%(f)s</a></td>
<td class="link">
- <a href="%(myrname)s;a=filehistory;f=%(newf)s">history</a> |
- <a href="%(myrname)s;a=tree;f=%(newf)s">tree</a>
+ <a href="%(myrname)s;a=filehistory;f=%(fullf)s">history</a> |
+ <a href="%(myrname)s;a=tree;f=%(fullf)s">tree</a>
</td>
""" % {
'myrname': config.myreponame,
'f': escape(f),
- 'newf': filter_file(dname + '/' + f),
+ 'fullf': urllib.quote(fullf),
}
else:
print """
@@ -1747,7 +1750,7 @@
""" % {
'myrname': config.myreponame,
'f': escape(f),
- 'fullf': filter_file(dname + '/' + f),
+ 'fullf': urllib.quote(fullf),
}
print '</tr>'
print '</table></div>'