fix(ui-svg-images): fix inlinesvg parser#2415
Merged
joyenjoyer merged 1 commit intomasterfrom Feb 24, 2026
Merged
Conversation
|
joyenjoyer
commented
Feb 20, 2026
| const namesAndValuesRegExp = | ||
| /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g | ||
| // Match either quoted or unquoted attribute values | ||
| // Handles both standard format: attr="value" and non-standard: attr=value |
Contributor
Author
There was a problem hiding this comment.
I would skip handling the non-standard format but we have to support it for backward compatibility.
matyasf
approved these changes
Feb 20, 2026
Collaborator
matyasf
left a comment
There was a problem hiding this comment.
looks good, I checked the icons too, they work
Comment on lines
-214
to
-217
| attributes[match[1]] = | ||
| match[2] || | ||
| (match[3] ? match[3] : match[4] ? match[4] : match[5]) || | ||
| match[1] |
Collaborator
There was a problem hiding this comment.
I dont understand the old code here... how can there be 5 matches?
Contributor
Author
There was a problem hiding this comment.
I tried it and match[4] and match[5] was always undefined for me. I guess the developer improved the regex by trial and error forgot to remove these obsolete capture groups.
git-nandor
approved these changes
Feb 23, 2026
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.
Closes INSTUI-4939
Fixed
InlineSVGattribute parsing bug where hyphenated SVG attributes (likestroke-width) were incorrectly parsed with extra quote characters by replacing the complex regex with a simpler solution that handles both quoted and unquoted (for backward compatibility) attribute values.Test:
SVGIcon, set thesrcprop (use ansvgwith thestroke-widthattribute, for example<SVGIcon src='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1"><circle cx="12" cy="12" r="10"/></svg>' />)stroke-widthattribute's value is set correctly (opening and closing quotes are there)