killmenot/parse-data-url

Fails to parse utf8 encoded json

Opened this issue · 1 comments

Honestly I'm not 100% sure if these are valid, but I have encountered data URIs that look like this:

data:application/json;utf8,{"key":"some value"}

OR

data:application/json,{"key":"some value"}

Running parseDataUrl on these returns false, so I have to special case these in my code. Raising this issue in case these should be supported by the library, but I will defer to public opinion on if this is in line with the data url specification

@TheWisestOne Thank you for letting me know about the issue. I think I will patch the lib on the week-end to make sure that the case data:application/json,{"key":"some value"} will work. I found a problem.

Regarding data:application/json;utf8,{"key":"some value"} - need to research a bit more.

P.S.
If it's urgent you can use the following one: https://github.com/jsdom/data-urls right now. Both your examples work correctly with it.