~lioploum/offpunk#28: 
links are broken in index pages when url doesn’t end with "/"

I think I identified an issue with netcache affecting the content of certain personal pages when a trailing slash is omitted. This may make browsing certain capsules a bit harder than it should. I don't really have a standalone reproducer for this issue, but the following one liners fetching some rawtext club member's home highlight the problem. First sample shows the correct output with the trailing slash in the URL:

$ echo -ne '\nquit\n' | ./offpunk.py gemini://rawtext.club/~bird/ | grep 'gemini://rawtext.club/~bird' | head -n1
ON> [1] gemini://rawtext.club/~bird/scratchpad.gmi
                             ^^^^^^^

When missing the trailing slash in the URL, the "home directory" disappears from the list of reachable URLs from the page:

$ echo -ne '\nquit\n' | ./offpunk.py gemini://rawtext.club/~bird | grep 'gemini://rawtext.club/~bird' | head -n1

$ echo -ne '\nquit\n' | ./offpunk.py gemini://rawtext.club/~bird | grep 'gemini://rawtext.club/' | head -n1
ON> [1] gemini://rawtext.club/scratchpad.gmi
                             ^?

As far as I can see, this behavior appeared in 2.0-beta1 and is still present in the 2.0 version. The 1.10 was not affected.

Status
RESOLVED IMPLEMENTED
Submitter
Étienne Mollier
Assigned to
No-one
Submitted
1 year, 3 months ago
Updated
1 year, 3 months ago
Labels
No labels applied.

~lioploum 1 year, 3 months ago

Ok, I understand the problem.

The link is a relative link: "=> scratchpad.gmi".

This means that offpunk believes that "~bird" is a file and thus that scratchpad.gmi should be on the same level.

I have no idea on how offpunk could guess that this is not a file but a folder. I think that the bug has always been present. Would be happy to know how to fix it properly. (in fact, I would be really glad to get information on the "index" file so I can save it appropriately in the cache instead of guessing)

~sotirisp 1 year, 3 months ago

For gemini://rawtext.club/~bird the server actually responds with a redirect to gemini://rawtext.club/~bird/ so it seems the URL used to resolve relative paths isn't updated to the one returned by the redirect. If some server doesn't return a redirect in that case then it should probably be considered buggy.

~lioploum REPORTED IMPLEMENTED 1 year, 3 months ago

I pushed a commit that should fix this issue. It is very hackish as the redirected URLs needs to go through all the existing layers. Not fan of the solution and needs a lot of testing to see if it didn’t break anything in the process.

~lioploum referenced this from #23 1 year, 3 months ago

Register here or Log in to comment, or comment via email.