Skip to content

Throw an error if inlineSvgFonts is called on a non-string #92

New issue

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

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

Already on GitHub? Sign in to your account

Merged

Conversation

adroitwhiz
Copy link
Contributor

Proposed Changes

This adds a check to inlineSvgFonts that ensures it is passed a string and not, say, an SVGElement or other input. If it's passed an invalid type, it will now throw an error.

Reason for Changes

inlineSvgFonts could easily be accidentally passed an SVGElement (as happened in scratchfoundation/scratch-paint#841). Before this change, it would fail silently and return the input without changing anything.

Copy link
Contributor

@paulkaplan paulkaplan left a comment

Choose a reason for hiding this comment

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

LGTM. Good thinking to make this more explicit

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.

3 participants