question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Content-Disposition filename ignored somehow

See original GitHub issue

Hello, currently I render my Browser documents with PDFJS however I have patched the viewer.js to support my Authorization header i just added httpHeaders to paramters before PDFJS.getdocument so nothing special, however PDFJS ignore’s my Content-Disposition Header which has a filename= it always gives me document.pdf

I tested against a CORS version and non cors currently this is my content-disposition:

 Content-Disposition:inline; filename="Angebot_412356.pdf"

Is there a setting that it should use this filename or do I miss something?

Currently it isn’t related to https://github.com/mozilla/pdf.js/issues/2407 since that will work on save + s. However on my side either Firefox/Chrome nobody gets the correct content-disposition i tried:

 Content-Disposition: inline; filename=name.pdf
 Content-Disposition: attachment; filename=name.pdf
 Content-Disposition: inline; filename="name.pdf"
 Content-Disposition: attachment; filename="name.pdf"

Also that’s the Code I added in viewer.js starting after Line 6373 and the PDFJS line is already there:

 var token = window.localStorage.getItem('token');
 var typ = window.localStorage.getItem('type');
 parameters.httpHeaders = {'Authorization': typ + ' ' + token};
 PDFJS.getDocument(parameters, pdfDataRangeTransport, passwordNeeded,

btw. I could also set the filename by myself, I think of the possibility that I know the filename already.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Koolstrcommented, Jun 7, 2017

This is still an issue, for me at least. Any updates? It’s been over a year.

0reactions
Snuffleupaguscommented, May 28, 2022

@ddemoss222 For future reference: Note that it’s always recommended to open a new issue, rather than commenting on one that was closed many years ago, since it’s often very easy for comments on old issues to be overlooked/ignored.

Without a runnable test-case it’s difficult (or rather impossible) to know for sure, but this is likely fixed by the PR referenced above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content-disposition filename "suggestion" is always ignored ...
The problem is that there is an extra carriage return / newline in the header. It should be: snprintf( header_str, 200, "Content-Type: ...
Read more >
ParseException Content-Disposition filename spaces
I have an email generated from Thunderbird 1.5.0.9 (Windows/20061207) which contains an attachment whose filename has spaces. JavaMail (1.4) throws a javax.mail ...
Read more >
118 - Content-Disposition filename parameters are ... - Monorail
Issue 118: Content-Disposition filename parameters are sometimes percent- ... cannot simply ignore what numerous web servers do (you're right that it's not ...
Read more >
Get content-disposition from Request header for file download
I am automating some document download steps and need to create an index of all files attached to a unique ID separately in...
Read more >
content-disposition - File Downloads - MSDN - Microsoft
You could not just post a link to the file and be able to change the name. Here is code to respond to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found