Standard URI
See original GitHub issueI am reporting: a bug or unexpected behavior.
Bug Report
I’m working on resolving https://github.com/ssbc/ssb-markdown/issues/25 and noticed that some Dat URIs don’t currently conform to URI syntax. URLs like dat://example.com are great, but when linking to a hash the //
should be removed, otherwise it’s parsed as a host (which has a maximum of 63 characters).
Instead, I think hash links should be presented (and parsed) as a path section rather than as a host. The only required change is to remove //
from the URI when there’s no host.
Expected behavior
64-character hash links should start with dat:
rather than dat://
.
Actual behavior
64-character hash links start with dat://
, so URI parsers throw an error as that’s not a valid host.
Thanks, I appreciate your help on this! Please let me know if there’s any other information I can provide.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:16 (4 by maintainers)
Top GitHub Comments
This was discussed a bit more in IRC and it sounds like there are other deviations from the URI spec (like
dat://hash+version
, which is an invalid hostname). From my perspective, the main takeaway was:It sounds like
parse-dat-url
has a way of parsing Dat identifiers, but since they aren’t URIs they aren’t going to be compatible with any standard parsers. I’m a bit bummed that Dat identifiers aren’t URIs or URLs but I’ll cross my fingers that we have the resources to make that change down the road.Really excited to see all of the great work being done with Dat, thanks! ❤️ 🎉
Just a reminder that adding a slash (
dat:///hash
) is valid, making the host “local” (arguably so in a P2P system) and moves the hash into the path (where length and parsing can be more flexible). You could also remove the slashes (dat:hash
).