accountant icon indicating copy to clipboard operation
accountant copied to clipboard

"Uncaught URIError: URI malformed" when using data URIs

Open p-himik opened this issue 5 years ago • 1 comments

Accountant uses goog.Uri.parse that in turn uses decodeURI, but it cannot parse data URIs that contain binary data that has not been encoded with base64.

An example of such URI: data:audio/midi,MThd%00%00%00%06%00%01%00%02%01%e0MTrk%00%00%00%19%00%FF%51%03%05%16%15%00%FF%59%02%00%00%00%FF%58%04%04%02%18%08%00%FF%2F%00MTrk%00%00%00%10%00%C0%00%00%90%45%55%83%30%80%45%00%00%FF%2F%00

It's a perfectly fine URI, but it cannot be decoded into a text representation.

p-himik avatar Sep 20 '20 18:09 p-himik

BTW data URI are not allowed to be used as navigation URIs, so maybe accountant could just ignore any <a> that has a download attribute.

p-himik avatar Sep 20 '20 18:09 p-himik