fixed issue 1448, headers in wiki media files, sorry Nico this fell under the radar and tool way longer than should have

This commit is contained in:
mdipierro
2013-08-29 21:32:36 -05:00
parent 7c47619e2f
commit db2469f109
2 changed files with 11 additions and 3 deletions

View File

@@ -1 +1 @@
Version 2.6.0-development+timestamp.2013.08.29.21.15.25
Version 2.6.0-development+timestamp.2013.08.29.21.31.47

View File

@@ -5629,7 +5629,7 @@ class Wiki(object):
return dict(content=content)
def media(self, id):
request, db = current.request, self.auth.db
request, response, db = current.request, current.response, self.auth.db
media = db.wiki_media(id)
if media:
if self.settings.manage_permissions:
@@ -5637,7 +5637,15 @@ class Wiki(object):
if not self.can_read(page):
return self.not_authorized(page)
request.args = [media.filename]
return current.response.download(request, db)
m = response.download(request, db)
current.session.forget() # get rid of the cookie
response.headers['Last-Modified'] = \
request.utcnow.strftime("%a, %d %b %Y %H:%M:%S GMT")
if 'Content-Disposition' in response.headers:
del response.headers['Content-Disposition']
response.headers['Pragma'] = 'cache'
response.headers['Cache-Control'] = 'private'
return m
else:
raise HTTP(404)