Repository navigation
fix(material/icon): escape the path prefixed to FuncIRI references - #34160
Open
moamenmahmod wants to merge 1 commit into
Open
moamenmahmod wants to merge 1 commit into
moamenmahmod wants to merge 1 commit into
Conversation
`_prependPathToReferences` interpolates the current path into a quoted
CSS `url('...')` string. Since a literal single quote is preserved in
`location.pathname`, such a path could close that string and append
further URL tokens to the attribute, which `mask` and `filter` accept
as a list. Escape backslashes and single quotes before interpolating,
so the value always resolves to exactly one reference on the current
origin. The id is escaped the same way.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Escapes backslashes and single quotes in the path (and in the id) before they are interpolated into the
url('…')value in_prependPathToReferences, so a path containing a literal quote cannot terminate the string and add further URL tokens to the attribute. The leading-slash normalization added in #33812 is unchanged, and a path with no'or\produces exactly the same value as before.Verified against Chrome's CSS parser: today's value parses as two
url()tokens when the path contains a quote (the second one resolving to another origin); with this change it parses as a single token on the current origin.Adds two regression tests next to the existing FuncIRI tests, covering a quote breakout and a backslash + quote path. Both assert that stripping the escape sequences leaves a single quoted URL, which fails on the current code and passes with this change.
Fixes #34159