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

If we pass a data URI to new DataURI - should we simply return it? #21

Closed
niftylettuce opened this issue Jun 10, 2017 · 2 comments · Fixed by #27
Closed

If we pass a data URI to new DataURI - should we simply return it? #21

niftylettuce opened this issue Jun 10, 2017 · 2 comments · Fixed by #27

Comments

@niftylettuce
Copy link

I ran into an edge case with https://github.com/jrit/web-resource-inliner - specifically here https://github.com/jrit/web-resource-inliner/blob/6ca0b528b6e7020c9782bc7d8ccbc5ea83818ae0/src/util.js#L184 where the src passed was actually a data URI component in itself. I will be submitting a PR to web-resource-inliner that sniffs if it's a data URI or not in that block of code, and if so, return the callback early - however I think that perhaps it should be built into this package?

My logic was, if we have a function... for example... named convertPathToString, it should return a string as the output. If we pass a string initially, it should just return the same thing.

Could use validator's isDataURI function here https://github.com/chriso/validator.js/blob/3443132beccddf06c3f0a5e88c1dd2ee6513b612/src/lib/isDataURI.js or import validator and use validator.isDataURI.

@tommedema
Copy link

Seems like a good proposal. I would indeed import validator if it were my decision to make.

@heldr
Copy link
Member

heldr commented May 3, 2020

FIxed

@heldr heldr closed this as completed May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants