Skip to content
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

Ensure that the contentDispositionFilename is always respected, when setting the document title (PR 13014 follow-up) #14964

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented May 28, 2022

Currently, when range-requests and/or streaming are not supported or for documents opened from data-URLs, we'll manually set the contentDispositionFilename (assuming it exists and is valid) from the onOpenWithData-callback in PDFViewerApplication.initPassiveLoading.
However, because of a small oversight in PDFViewerApplication._initializeMetadata, this cached contentDispositionFilename would be ignored and we'd only attempt to use the one returned by PDFDocumentProxy.getMetadata in the API (which in the cases outlined above will always be empty).

Also, to ensure that the document properties dialog always displays the correct fileName we'll now lookup it using the same exact method as in the viewer itself (via a new callback-function).

@Snuffleupagus Snuffleupagus force-pushed the onOpenWithData-contentDispositionFilename branch from d445a9e to 872ca3b Compare May 28, 2022 09:40
@Snuffleupagus
Copy link
Collaborator Author

This probably fixes #6396 (comment), but given that lack of a runnable test-case it's impossible to know for sure.

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/6f14bd51c3c7445/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/6f14bd51c3c7445/output.txt

Total script time: 2.51 mins

Published

@Snuffleupagus Snuffleupagus force-pushed the onOpenWithData-contentDispositionFilename branch from 872ca3b to a5eb433 Compare May 28, 2022 10:38
…n setting the document title (PR 13014 follow-up)

Currently, when range-requests and/or streaming are not supported or for documents opened from `data`-URLs, we'll manually set the `contentDispositionFilename` (assuming it exists and is valid) from the `onOpenWithData`-callback in `PDFViewerApplication.initPassiveLoading`.
However, because of a small oversight in `PDFViewerApplication._initializeMetadata`, this *cached* `contentDispositionFilename` would be ignored and we'd only attempt to use the one returned by `PDFDocumentProxy.getMetadata` in the API (which in the cases outlined above will always be empty).

Also, to ensure that the document properties dialog always displays the *correct* fileName we'll now lookup it using the same exact method as in the viewer itself (via a new callback-function).
@Snuffleupagus Snuffleupagus force-pushed the onOpenWithData-contentDispositionFilename branch from a5eb433 to 0599ce7 Compare May 28, 2022 10:39
@timvandermeij timvandermeij merged commit a43a30b into mozilla:master May 29, 2022
@timvandermeij
Copy link
Contributor

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants