opensanctions / opensanctions/unmhtml
Fonts missing from Chromium MHTML saves (known Chromium bug)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Problem
When saving pages as MHTML using Chromium (including via Playwright or CDP's Page.captureSnapshot), web fonts are frequently missing from the archive. The @font-face declarations in CSS reference font files by URL path, but the actual font binaries are not included as MIME parts.
Root cause
This is a known, long-standing Chromium bug: chromium issue 40219015
Chromium's FrameSerializer has code to embed fonts (AddFontToResources()), but it checks font.IsLoaded() and font.ResourceBuffer() at save time. If a font was lazily loaded or has been evicted from the resource cache, it is silently skipped. There is no Chrome flag or setting to control this behavior.
Workarounds
- Ensuring all fonts are fully loaded before saving (e.g., using
document.fonts.readyin Playwright) may improve results, but is not guaranteed. - SingleFile (browser extension) actively fetches and embeds all resources including fonts, but is not usable in headless/Playwright workflows.
References
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository file, test, or entry point. Start by reviewing Chromium issue 40219015 and reproducing an MHTML save with a web font; done would require a confirmed project-level workaround or an upstream Chromium fix.
Written by the indexing model from the issue text.
Assessment
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100