Skip to content

fix: rebase external font URLs onto the bundled stylesheet - #8373

Merged
SamTV12345 merged 1 commit into
ether:developfrom
antoineauger:fix/css-font-urls-relative-to-stylesheet
Oct 20, 2026
Merged

SamTV12345 merged 1 commit into
ether:developfrom
antoineauger:fix/css-font-urls-relative-to-stylesheet

Conversation

@antoineauger

@antoineauger antoineauger commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Since fonts stopped being inlined (#8314), the authored URLs in src/static/css/pad/ are emitted verbatim.

They are relative to the importing file, so they only resolve when the bundle is served from the document root; under a subpath prefix the ../.. segments climb out of it and every editor and toolbar font 404s.

Rebase external font URLs onto the entry stylesheet's directory, which mirrors the served layout under src/static, and leave absolute URLs alone. Add a regression test that resolves the font URLs against a prefixed stylesheet and fails if any escapes the served static root.

UI changes

  • This PR doesn't add or change anything users see or interact with.
  • This PR changes the UI, and I clicked through it myself in a browser and I'm happy with the UI/UX. If an AI tool wrote any of it, only tick this after you've tried it yourself.

/cc @nejch

🛠️ with ❤️ by Siemens

Since fonts stopped being inlined (ether#8314), the authored URLs in
src/static/css/pad/ are emitted verbatim. They are relative to the
importing file, so they only resolve when the bundle is served from the
document root; under a subpath prefix the ../.. segments climb out of it
and every editor and toolbar font 404s.

Rebase external font URLs onto the entry stylesheet's directory, which
mirrors the served layout under src/static, and leave absolute URLs
alone. Add a regression test that resolves the font URLs against a
prefixed stylesheet and fails if any escapes the served static root.
@antoineauger
antoineauger marked this pull request as ready for review October 20, 2026 14:48
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix font URLs in bundled CSS under subpath deployments

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Rebase external font URLs onto the bundled stylesheet so fonts load under subpath prefixes.
• Preserve absolute URLs and add regression coverage for font paths escaping the served static root.
Diagram

graph TD
  A["Authored CSS"] --> B["Font URL resolver"] --> C["Bundled stylesheet"] --> D(["Browser under prefix"]) --> E["Static font files"]
  F["CSS minifier"] --> B
Loading
High-Level Assessment

Rebasing in the existing esbuild resolver directly addresses the mismatch between imported CSS paths and the served bundle location while retaining external, cacheable fonts. Emitting fonts through a file loader would require additional output and serving changes without a clear benefit here.

Files changed (2) +48 / -17

Bug fix (1) +27 / -11
MinifyWorker.tsRebase relative external font URLs to the CSS entry directory +27/-11

Rebase relative external font URLs to the CSS entry directory

• The esbuild font resolver now computes relative URLs from each import location to the entry stylesheet's directory. It leaves absolute URLs unchanged and continues to emit fonts as external assets.

src/node/utils/MinifyWorker.ts

Tests (1) +21 / -6
cssFontInlining.tsVerify bundled font URLs resolve within a prefixed static root +21/-6

Verify bundled font URLs resolve within a prefixed static root

• The file-existence check now resolves URLs from the bundled stylesheet's directory. A new test resolves each external font URL against a stylesheet served under a subpath and rejects paths that escape its static root.

src/tests/backend/specs/cssFontInlining.ts

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can open the rule or relationship behind a finding in one click

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@antoineauger

Copy link
Copy Markdown
Contributor Author

This is ready for review @SamTV12345, thanks a lot 🙇🏻

/cc @sirsqm since you worked on #8314

@SamTV12345
SamTV12345 merged commit 898e3df into ether:develop Oct 20, 2026
21 checks passed
@SamTV12345

Copy link
Copy Markdown
Member

This is ready for review @SamTV12345, thanks a lot 🙇🏻

/cc @sirsqm since you worked on #8314

Thanks for the work. Confirmed :)

@antoineauger
antoineauger deleted the fix/css-font-urls-relative-to-stylesheet branch October 21, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants