Buran icon indicating copy to clipboard operation
Buran copied to clipboard

Not removing dot segments when resolving relative URLs

Open acidus99 opened this issue 2 years ago • 1 comments

Buran 1.12 is not properly resolving relative URLs. Specifically, Buran is not removing "dot segments" (e.g. ../ or ./) which is required by RFC 3986 when resolving URLs.

Look at this URL: gemini://rawtext.club/~winter/gemlog/2023/8-18.gmi

At the bottom of the page there is a link line:

=> .. gemlog

This relative URL should be resolved to the fully qualified URL gemini://rawtext.club/~winter/gemlog/, which should then be sent in the Gemini request. Instead, it Buran sends the URL gemini://rawtext.club/~winter/gemlog/2023/.. in the request. While some servers may handle that URL, most don't, including that capsule, which returns a 50 server error saying it's a bad request.

When resolving relative URLs, you should use the algorithm described in section 5.2 of RFC 3986, specifically section 5.2.4: Remove Dot Segments. Most URL libraries do this automatically when parsing/resolving URLs. Perhaps Buran is using an out-of-date library, or not using a proper URL parsing library.

acidus99 avatar Aug 22 '23 11:08 acidus99

My server (Agate) seems to handle this, but it causes weird link loops. As I have documents nested a few levels deep, Buran cannot properly go all the way back up the tree when I am clicking through a bunch of .. links.

ProjectMoon avatar Feb 16 '24 08:02 ProjectMoon