Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
6136:acfb9fa494e2 | 6137:1c0e7afe824a |
---|---|
83 def httphdr(self, type=None, filename=None, length=0, headers={}): | 83 def httphdr(self, type=None, filename=None, length=0, headers={}): |
84 headers = headers.items() | 84 headers = headers.items() |
85 if type is not None: | 85 if type is not None: |
86 headers.append(('Content-Type', type)) | 86 headers.append(('Content-Type', type)) |
87 if filename: | 87 if filename: |
88 filename = (filename.split('/')[-1] | |
89 .replace('\\', '\\\\').replace('"', '\\"')) | |
88 headers.append(('Content-Disposition', | 90 headers.append(('Content-Disposition', |
89 'inline; filename=%s' % filename.split('/')[-1])) | 91 'inline; filename="%s"' % filename)) |
90 if length: | 92 if length: |
91 headers.append(('Content-Length', str(length))) | 93 headers.append(('Content-Length', str(length))) |
92 self.header(headers) | 94 self.header(headers) |
93 | 95 |
94 def wsgiapplication(app_maker): | 96 def wsgiapplication(app_maker): |