March 5, 2016

I have a website that allows download of a zip file. This zip file is created on the fly, and by using the Content-Disposition header I can determine the filename it is saved as.

This particular download worked in Firefox but not in Chrome. It turns out that Chrome has a problem where the filename contains a comma - the download fails with an error ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION.

The way to fix this is to surround the filename in the header with double quotes:

resp = HttpResponse(s.getvalue(), content_type = "application/x-zip-compressed")
resp['content-disposition'] = 'attachment; filename="%s"' % lZipFileName