-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download button ignores Content-Disposition/filename header #2407
Comments
Yes this is a major problem, all my downloaded PDF files have the wrong name now! This should be fixed sooner than later. |
I'm looking into it. |
@waddlesplash , you can look into getting Content-Disposition header somewhere at https://github.com/mozilla/pdf.js/blob/master/extensions/firefox/components/PdfStreamConverter.js#L582 (similar to
|
there is also contentDispositionFilename (http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIChannel.idl#294) |
I'm having trouble using the following code: const Cu = Components.utils;
Cu.import('resource://gre/modules/Services.jsm'); In the web console:
|
(from |
viewer.js runs with content permissions. You need to be in chrome code to use Cu. The chrome privileged code lives in https://github.com/mozilla/pdf.js/blob/master/extensions/firefox/components/PdfStreamConverter.js |
So where should I put the code that retrieves the header and how should |
|
Since it's mostly for the extension, if possible, place all code into PdfStreamConverter.js |
But some code has to go into viewer.js for the download button, right? |
I don't see why, the code in the viewer.js just executes https://github.com/mozilla/pdf.js/blob/master/extensions/firefox/components/PdfStreamConverter.js#L235 |
Fixed by #2635 |
Ctrl+S part is dup of #943 |
Look at a PDF file served at the URL "view.aspx" with the following response header:
Content-Disposition:filename=myfile.pdf
Now compare:
Evidently, the download button ignores the content-disposition header, while Firefox's "download page" functionality does not.
(sorry I would give you a live example but this is a utility bill behind login)
The text was updated successfully, but these errors were encountered: