Illegal Character In URL
A link showed up in Antenna today that won't open in Alhena because the URL contains an unecoded ">". Alhena uses Java's URI class to parse out the scheme, host, path and query and since the URI class strictly implements RFC3986, trying to parse the url throws an exception.
That said, the link will open in Lagrange and Amfora. I could probably do some gymnastics to make it work but I'm leaning towards displaying an error message instead. I can't find anything in the Gemini spec that suggests ">" is somehow an exception to the percent-encoding rules defined in RFC 3986.
Any thoughts?
Sep 14 ยท 4 weeks ago
5 Comments โ
๐ skyjake [...] ยท Sep 14 at 04:11:
It is also Antenna that accepted this URI, plus of course the server hosting the resource has no problem with it. Maybe everyone is following Postel's law here?
You are right in that this particular URI is not fully valid according to RFC 3986, however I don't think the Gemini specification calls for outright rejection with an error. If you want to be more strict than others seem to be, maybe display a warning and percent-encode the URI appropriately before passing it to Java?
๐ฆ bluesman [OP] ยท Sep 14 at 13:55:
Thanks. I do wonder if everyone (or some subset therein) is actually following Postel's Law inadvertently. Regardless, I put in some conservative code to sanitze the URL. There does seem to be some flexibility in how the spec is interpreted which comes as a bit of a surprise. Anyway, good to know.
๐ mbays ยท Sep 14 at 15:03:
I think it's best to at least give a warning when encountering invalid link URIs. There are a lot of them about (including people jumping the gun and using IRIs), and there might be fewer if gemtext authors were warned by their client about it.
๐ skyjake [...] ยท Sep 14 at 15:13:
@mbays I agree that warnings could help here. The major problem with that approach is that the warning is mostly shown to the wrong audience, i.e., people browsing stuff without any agency to fix the issue. Pragmatically, in this particular instance, Antenna should have acted as the validator and maybe even rejected the invalid URL.
๐ฆ bluesman [OP] ยท Sep 14 at 16:17:
I added a status message. Blink and you'll miss it though - the text gets replaced with load time, TLS type and cipher suite once the page is done loading. Someday I'll add a log viewer and curious minds will be able to find it there.
Source