[gen] pod field: bugfix: download a generated or frozen pod result.

This commit is contained in:
Gaetan Delannay 2014-10-03 20:27:54 +02:00
parent 1455a74056
commit d9d93a650b
2 changed files with 7 additions and 3 deletions

View file

@ -212,11 +212,12 @@ class FileInfo:
self.modified = DateTime()
self.size = os.stat(fsName).st_size
def writeResponse(self, response, dbFolder=''):
def writeResponse(self, response, dbFolder='', disposition='inline'):
'''Writes this file in the HTTP p_response object.'''
# As a preamble, initialise response headers.
header = response.setHeader
header('Content-Disposition', 'inline;filename="%s"' % self.uploadName)
header('Content-Disposition',
'%s;filename="%s"' % (disposition, self.uploadName))
header('Content-Type', self.mimeType)
header('Content-Length', self.size)
header('Accept-Ranges', 'bytes')

View file

@ -731,7 +731,10 @@ class Pod(Field):
# attachment?
mailing = rq.get('mailing')
if not mailing:
res.writeResponse(rq.RESPONSE)
# With disposition=inline, Google Chrome and IE may launch a PDF
# viewer that triggers one or many additional crashing HTTP GET
# requests.
res.writeResponse(rq.RESPONSE, disposition='attachment')
return
else:
# Send the email(s).