Description
Currently, blobToDataUrl
simply puts blob.type
into the URL (at this line), but it should be cleaned up to be valid:
-
blob.type
may contain white space (e.g. I encountered a'data:image/png; qs=0.7;base64,iVB…'
from aResponse.blob()
in Firefox). I looked up its definition in the File API draft spec; which allows it to be any parseable mime type as defined in whatwg’s mime sniffing spec that bases on RFC 7231 §3.1.1.1 (HTTP media types) which indeed allows whitespace around semicolons. (confusingly however, that latter one is based on RFC 2046 which depends on RFC 2045, which in fact seems to not permit whitespace even though spaces do appear in its own examples… though I have not checked all its errata; in any case, fact is that white space can occur) And adata:
url obviously does not permit white space (see its syntax definition in RFC2397). -
As that data url spec (RFC2397) states, parameter values using quoted strings should instead be percentage-encoded:
Attribute values in [RFC2045] are allowed to be either represented as
tokens or as quoted strings. However, within a "data" URL, the
"quoted-string" representation would be awkward, since the quote mark
is itself not a valid urlchar. For this reason, parameter values
should use the URL Escaped encoding instead of quoted string if the
parameter values contain any "tspecial". -
Perhaps any other caveats?
I may tackle this myself sometime. For now I thought to just raise the issue already and park my research notes here. :)