Skip to content

Improve data URI parsing. #24

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
merged 1 commit into from
Dec 7, 2015
Merged

Improve data URI parsing. #24

merged 1 commit into from
Dec 7, 2015

Conversation

bdusell
Copy link
Contributor

@bdusell bdusell commented Sep 18, 2015

The data URI string, which is potentially very large, was being split repeatedly on ','. This version uses a regex to parse the media type, encoding, and data string from the data URI. It does some stricter validation of the data URI format and also defaults to the media type text/plain as specified in RFC 2397. Some (very informal) profiling showed the two versions to have very similar performance on small strings, with the new version being slightly faster on large strings. Surprisingly, the difference is not very big.

blueimp added a commit that referenced this pull request Dec 7, 2015
Improve data URI parsing.
@blueimp blueimp merged commit 783b0bc into blueimp:master Dec 7, 2015
@blueimp
Copy link
Owner

blueimp commented Dec 7, 2015

Thanks @bdusell and sorry it took so long for me to review and merge your pull request.

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

Successfully merging this pull request may close these issues.

2 participants