Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove svg: tag prefix in fixupSvgString #209

Merged
merged 2 commits into from
Jan 14, 2021

Conversation

adroitwhiz
Copy link
Contributor

Resolves

Resolves scratchfoundation/scratch-paint#1320

Closes #197

Proposed Changes

This PR adds functionality to fixupSvgString to remove the svg: prefix from all tags that may have it.

Reason for Changes

Both DOMPurify and the paint editor seem to choke on prefixed tags, which Inkscape will sometimes output (see #197 for more on DOMPurify). This allows SVGs with prefixed tags to load properly once more.

I was a bit wary of going the regex route, but this method already uses copious amounts of parsing-XML-with-regex, so surely one more can't hurt.

Test Coverage

A test has been added to ensure this works

Copy link
Contributor

@fsih fsih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks great!

@fsih fsih merged commit d455bd5 into scratchfoundation:develop Jan 14, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues With Sprites on Older Projects
2 participants