Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/request.py @ 6137:1c0e7afe824a
hgweb: Quote filenames when downloading raw files.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sat, 16 Feb 2008 18:12:30 +0100 |
parents | acfb9fa494e2 |
children | e75aab656f46 |
line wrap: on
line diff
--- a/mercurial/hgweb/request.py Sat Feb 16 17:51:30 2008 +0100 +++ b/mercurial/hgweb/request.py Sat Feb 16 18:12:30 2008 +0100 @@ -85,8 +85,10 @@ if type is not None: headers.append(('Content-Type', type)) if filename: + filename = (filename.split('/')[-1] + .replace('\\', '\\\\').replace('"', '\\"')) headers.append(('Content-Disposition', - 'inline; filename=%s' % filename.split('/')[-1])) + 'inline; filename="%s"' % filename)) if length: headers.append(('Content-Length', str(length))) self.header(headers)