Closed marcprux closed 4 years ago
This may block the caller queue, if your search SVG contents file size larger than 1MB. Because isSVGFormatForData
is called from main queue.
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
Merge for now. For SDWebImage Core repo, I'll submit another PR.
Release v1.5.2
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.
The current
isSVGFormatForData
breaks when the SVG is less than 100 characters, which should be permitted (e.g., "<svg><circle/></svg>
" is valid SVG).