We're updating the issue view to help you get more done.Learn more

ePubs downloading as zip files or opening as gibberish in the browser when other files for that work have been generated

We've received numerous complaints, across all browsers and platforms, of ePub files for works download as zip files, or simply opening in the browser as gibberish:

Not implemented

It appears that if the ePub is not the first file generated (e.g. the HTML file exists), the content type is incorrectly set to text/plain:

curl -I http://ao3-app98:7084/downloads/Cr/Creator/2592860/File%20Name.epub
HTTP/1.1 200 OK
Date: Sun, 24 Sep 2017 08:20:56 GMT
Connection: close
Last-Modified: Sun, 24 Sep 2017 08:20:36 GMT
Content-Type: text/plain
Content-Length: 18965

It should look like:

curl -I http://ao3-app98:7084/downloads/Cr/Creator/2592860/File%20Name.epub
HTTP/1.1 200 OK
Date: Sun, 24 Sep 2017 08:20:36 GMT
Connection: close
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/epub+zip
Content-Disposition: attachment; filename="File Name.epub"
Content-Transfer-Encoding: binary
Cache-Control: private
X-Request-Id: 20f2e13b-f870-46f7-a7cb-e1df60782ed1
X-Runtime: 0.695178
Transfer-Encoding: chunked

This is caused by the file cache. Because we have other types of caching, we'd like to remove this one.

The problem isn't reproducible outside production, so just make sure downloads still work on staging, and then we'll see if this resolves the issue on production.

Status

Assignee

james_

Reporter

james_