Skip to content

Conversation

@rskew
Copy link
Contributor

@rskew rskew commented Oct 6, 2025

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.

Copy link
Owner

@geekscape geekscape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +51 to +52
if data_url.startswith("data:"):
raise NotImplementedError("'data:' URLs do not have a path component")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +59 to +60
if data_url.startswith("data:"):
return "data"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants