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

Ignore Metadata entries with incorrectly encoded characters, when setting the viewer title (bug 1605526) #11423

Merged
merged 2 commits into from
Dec 24, 2019

Conversation

Snuffleupagus
Copy link
Collaborator

Apparently Ghostscript can, in some cases, generate/include Metadata with incorrectly encoded characters.[1] This results in the viewer title looking wrong, which we thus attempt to avoid by falling back to the Info entry instead.

Please note: Obviously it would be better if this was fixed in the Metadata parser instead, rather than using a viewer work-around, but I'm just not sure how or even if that could actually be done given that the Metadata stream contains no trace of the original character.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1605526


[1] The problematic characters are from the Specials Unicode block, see https://en.wikipedia.org/wiki/Specials_(Unicode_block)

…tadata` data

With these changes we'll always set the `pdfTitle` to the `Info` dictionary entry *first* (assuming it exists and isn't empty), before attempting to override it with the `Metadata` stream entry (assuming it exists, is non-empty *and* valid).

There should be no functional changes with this patch, but it will simplify the following patch somewhat.
web/app.js Outdated Show resolved Hide resolved
…ting the viewer title (bug 1605526)

Apparently Ghostscript can, in some cases, generate/include `Metadata` with incorrectly encoded characters.[1] This results in the viewer title looking wrong, which we thus attempt to avoid by falling back to the `Info` entry instead.

*Please note:* Obviously it would be better if this was fixed in the `Metadata` parser instead, rather than using a viewer work-around, but I'm just not sure how or even *if* that could actually be done given that the `Metadata` stream contains no trace of the *original* character.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1605526

---
[1] The problematic characters are from the Specials Unicode block, see https://en.wikipedia.org/wiki/Specials_(Unicode_block)
@Snuffleupagus
Copy link
Collaborator Author

/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.67.70.0:8877/a19db83c651bc69/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/a19db83c651bc69/output.txt

Total script time: 1.73 mins

Published

@timvandermeij timvandermeij merged commit 11b56ad into mozilla:master Dec 24, 2019
@timvandermeij
Copy link
Contributor

I also looked at the XMP data and couldn't find the original character too, so I think this is the only possible solution here. Thank you for fixing this, and for mentioning the bug IDs for future reference!

@Snuffleupagus Snuffleupagus deleted the bug-1605526 branch December 25, 2019 10:19
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