Repository navigation
Conversation
| const selected = | ||
| alternatives.find(node => | ||
| node.attributes.some( | ||
| ({ name, value }) => name === "xml:lang" && value === "x-default" |
There was a problem hiding this comment.
From the XMP specs:
...all comparisons of xml:lang values shall be case-insensitive.
There was a problem hiding this comment.
Done, the x-default comparison is case-insensitive now.
| this._parseArray(entry); | ||
| continue; | ||
| case "dc:title": | ||
| case "dc:description": |
There was a problem hiding this comment.
From the XMP specs, dc:rights and xmpRights:UsageTerms has a language alternative too.
| "", | ||
| ], | ||
| [ | ||
| "<rdf:Bag><rdf:li>One</rdf:li><rdf:li>Two</rdf:li></rdf:Bag>", |
There was a problem hiding this comment.
I'm not sure it's a good idea to test malformed data...
There was a problem hiding this comment.
Agreed, I removed that test.
| expect([...metadata]).toEqual([["dc:title", "Foo bar baz"]]); | ||
| }); | ||
|
|
||
| it("should select the default language alternative (issue 20801)", function () { |
There was a problem hiding this comment.
In this test and the others, make sure we've a way to know what's failing exactly (in case something is failing) in using withContext.
There was a problem hiding this comment.
Done, each assertion now has a context with the property name and the input.
| const metadata = createMetadata(data); | ||
|
|
||
| expect(metadata.get(name)).toEqual("Hello World"); | ||
| expect(metadata.getRaw()).toEqual(data); |
There was a problem hiding this comment.
No good reason, it came from copying another test. Removed.
Fixes mozilla#20801. `dc:title`, `dc:description`, `dc:rights` and `xmpRights:UsageTerms` are language alternatives, so pick the `x-default` entry (compared case-insensitively, as the XMP specification requires), or the first one when there is no default, instead of concatenating all of them. Continues the approach proposed by @nyxsky404 in mozilla#20874.
b70e430 to
abb98d9
Compare
Viewer previewCommit abb98d9 (build logs).
🔒 A user with write access must approve this commit with the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21999 +/- ##
==========================================
- Coverage 90.22% 90.13% -0.09%
==========================================
Files 275 275
Lines 67837 67845 +8
==========================================
- Hits 61203 61154 -49
- Misses 6634 6691 +57
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #20801.
PDFs with multiple XMP language alternatives currently show concatenated values, such as
Hello WorldHello World. Fordc:title,dc:description,dc:rightsandxmpRights:UsageTerms, select thex-defaultentry (compared case-insensitively, per the XMP specification), or the first entry when there is no default.This continues the earlier work in #20874 by @nyxsky404, which the author closed.