Skip to content
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

Make isSVGFormatForData work for small SVG strings #26

Merged
merged 1 commit into from
Aug 14, 2020

Conversation

marcprux
Copy link
Contributor

The current isSVGFormatForData breaks when the SVG is less than 100 characters, which should be permitted (e.g., "<svg><circle/></svg>" is valid SVG).

The current `isSVGFormatForData` breaks when the SVG is less than 100 characters, which should be permitted (e.g., "`<svg><circle/></svg>`" is valid SVG).
@dreampiggy
Copy link
Collaborator

This may block the caller queue, if your search SVG contents file size larger than 1MB. Because isSVGFormatForData is called from main queue.

@dreampiggy
Copy link
Collaborator

If you want to change, maybe we need to change the same logic in
https://github.com/SDWebImage/SDWebImage/blob/master/SDWebImage/Core/NSData%2BImageContentType.m#L76

@dreampiggy
Copy link
Collaborator

Merge for now. For SDWebImage Core repo, I'll submit another PR.

@dreampiggy dreampiggy merged commit db90880 into SDWebImage:master Aug 14, 2020
@dreampiggy dreampiggy added the fix Bugfix label Aug 14, 2020
@dreampiggy
Copy link
Collaborator

Release v1.5.2

@marcprux
Copy link
Contributor Author

I don't see how it blocks any more than the previous code did … both of them are only checking the last 100 bytes of the NSData for the closing "" tag. The fix simply also permits checking in SVG data that is itself less than 100 bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants