venantius / accountant

ClojureScript navigation for single-page applications, made simple.
Eclipse Public License 1.0
250 stars 39 forks source link

"Uncaught URIError: URI malformed" when using data URIs #66

Open p-himik opened 3 years ago

p-himik commented 3 years ago

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 commented 3 years ago

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.