Skip to content

Fix incorrect PDF title display when multiple language titles present in XMP metadata (issue 20801)#20874

Open
nyxsky404 wants to merge 3 commits intomozilla:masterfrom
nyxsky404:issue20801
Open

Fix incorrect PDF title display when multiple language titles present in XMP metadata (issue 20801)#20874
nyxsky404 wants to merge 3 commits intomozilla:masterfrom
nyxsky404:issue20801

Conversation

@nyxsky404
Copy link

Fixes #20801

Problem

When a PDF has multiple language titles in XMP metadata using rdf:Alt, the titles were being concatenated instead of selecting a single title. For example, a PDF with both x-default and en language titles would display "Hello WorldHello World" instead of "Hello World".

Solution

  • Added _parseLangAlt method to properly handle rdf:Alt elements for dc:title and dc:description
  • Selects x-default language entry if present, otherwise uses the first entry
  • Falls back to textContent for backward compatibility with plain text values
  • Enabled hasAttributes option in SimpleXMLParser to read xml:lang attributes

Testing

  • Added unit tests for multiple language titles with x-default
  • Added unit tests for multiple language descriptions without x-default
  • All existing metadata tests continue to pass

@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.56%. Comparing base (3127492) to head (7443fab).
⚠️ Report is 110 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20874      +/-   ##
==========================================
+ Coverage   62.51%   62.56%   +0.04%     
==========================================
  Files         173      173              
  Lines      121246   121278      +32     
==========================================
+ Hits        75796    75872      +76     
+ Misses      45450    45406      -44     
Flag Coverage Δ
fonttest 7.66% <ø> (?)
unittestcli 62.53% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

[Bug]: PDF title displayed incorrectly when multiple language titles present in XMP metadata

3 participants