Fix filename in batch file download link (again).

This hopefully prevents encoding errors which were bound to happen...
This commit is contained in:
Lance Edgar 2015-02-12 23:32:17 -06:00
parent 26e5be9897
commit 6c7f1afcf4

View file

@ -685,7 +685,8 @@ class FileBatchCrud(BatchCrud):
path = batch.filepath(config)
response = FileResponse(path, request=self.request)
response.headers[b'Content-Length'] = str(batch.filesize(config))
response.headers[b'Content-Disposition'] = b'attachment; filename="{0}"'.format(batch.filename)
response.headers[b'Content-Disposition'] = b'attachment; filename="{0}"'.format(
batch.filename.encode('ascii', 'replace'))
return response