Skip to content

Resolve double-quoted URLs in style sheets against the sheet - #278

Merged
eXpl0it3r merged 1 commit into
masterfrom
fix/quoted-relative-url
Nov 10, 2026
Merged

eXpl0it3r merged 1 commit into
masterfrom
fix/quoted-relative-url

Conversation

@eXpl0it3r

Copy link
Copy Markdown
Collaborator

A relative URL in a linked style sheet is supposed to resolve against the style sheet's URL, but this only worked for url(yellow) and url('yellow'). With url("yellow") in https://example.org/style/basic.css, the background image or @font-face font got requested from https://example.org/style/%22yellow%22 and failed to load. StylesheetLoadHandler.CorrectRelativeUrls only stripped single quotes before rebasing the URL, so the double quotes ended up as part of the path. Escapes weren't handled either, e.g. url('a\'b.png') turned the backslash into a / and url("a)b.png") got cut off at the first ).

The url() argument is now read the way CSS 2.1 defines it, with optional whitespace, either quote style and backslash escapes, then resolved against the style sheet and written back quoted, so characters like ' and ( in the absolute URL don't break the token.

How to test this PR?

CI should succeed. FontFaceInALinkedStyleSheet_ResolvesAgainstTheStyleSheetUrl checks the requested font URL for unquoted, single-quoted, double-quoted and escaped url() values, the double-quoted, padded and escaped cases fail on master.

@eXpl0it3r
eXpl0it3r force-pushed the fix/quoted-relative-url branch from 6c427e6 to 846bbdd Compare November 10, 2026 19:06
@eXpl0it3r
eXpl0it3r merged commit 64e136d into master Nov 10, 2026
18 checks passed
@eXpl0it3r
eXpl0it3r deleted the fix/quoted-relative-url branch November 10, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant