Add support for URLs with scheme 'data:'#48
Conversation
geekscape
left a comment
There was a problem hiding this comment.
Let's tackle the requirements and design of the "data:" scheme and relevant DataScheme "data:" plug-in as a new feature Issue, please.
I'll make the improvement to incorporate the standard Python URL parsing library function call.
| if data_url.startswith("data:"): | ||
| raise NotImplementedError("'data:' URLs do not have a path component") |
There was a problem hiding this comment.
The URL specification effectively states that all URLs have a path component ... including the data: scheme.
Therefore, parse_data_url_path() should always return a valid path and not raise an Exception.
Note: For the data: scheme it is invalid to have an empty path and there must be at least a comma that separates the (optional) media type / parameters from the data, e.g data:,
Time for me to incorporate the standard Python URL parsing library function call.
| if data_url.startswith("data:"): | ||
| return "data" |
There was a problem hiding this comment.
The URL specification is "scheme:[//authority]path" and web browsers typically accept just "path" to mean "file:path" (with an empty authority). Need to properly handle various combinations of URLs with "scheme:path", "scheme://path", "scheme://authority/path" or just "path".
Time for me to incorporate the standard Python URL parsing library function call.
For writing tests, it's useful to encode frame data directly in a URL according to https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data
Note: I'm not sure how to implement this scheme handler in Aiko, as the framing should be done in a way that's specific to the media-type of the data.