comparison mercurial/hgweb/request.py @ 6136:acfb9fa494e2

hgweb: Pass only filename instead of full path when downloading raw files. Before this patch "filename=foo/bar" was sent and e.g. Firefox offered to save the file as "foo-bar" instead of just "bar".
author Thomas Arendsen Hein <thomas@intevation.de>
date Sat, 16 Feb 2008 17:51:30 +0100
parents 948a41e77902
children 1c0e7afe824a
comparison
equal deleted inserted replaced
6135:be91a77b7f18 6136:acfb9fa494e2
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 headers.append(('Content-Disposition', 'inline; filename=%s' % 88 headers.append(('Content-Disposition',
89 filename)) 89 'inline; filename=%s' % filename.split('/')[-1]))
90 if length: 90 if length:
91 headers.append(('Content-Length', str(length))) 91 headers.append(('Content-Length', str(length)))
92 self.header(headers) 92 self.header(headers)
93 93
94 def wsgiapplication(app_maker): 94 def wsgiapplication(app_maker):