Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative links dont work #114

Open
trufae opened this issue Jun 16, 2024 · 3 comments
Open

Relative links dont work #114

trufae opened this issue Jun 16, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@trufae
Copy link

trufae commented Jun 16, 2024

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to gemini://lolcathost.org/
  2. Click on recipes
  3. Scroll down and click on BROKEN LINK
  4. See error

Expected behavior

Works fine if i do /recipes/fregides.gmi . this link works well in lagrange

Screenshots
If applicable, add screenshots to help explain your problem.

Software info (please complete the following information):

  • OS: Ubuntu / flatpak
  • Geopard's Version 1.5.0

Additional context
Add any other context about the problem here.

@trufae trufae added the bug Something isn't working label Jun 16, 2024
@tfuxu
Copy link
Contributor

tfuxu commented Jun 16, 2024

I can reproduce this on the latest commit. Might be related to b27023f

@tfuxu
Copy link
Contributor

tfuxu commented Jun 16, 2024

Looks like the culprit here is parse_link from Hypertext. The issue stems from base_url() function of url::ParseOptions that cuts path elements from provided URL, if it doesn't have a trailing slash. This is a intended behavior, as noted in join() function (here).

@ranfdev How we should fix it? Lagrange for example just adds a trailing slash at the end of every URL. We could do that, or add a check in parse_link to know when to add slash.

@ranfdev
Copy link
Owner

ranfdev commented Jun 17, 2024

I've tested the behavior of a simple http server running with python -m http.server, in a folder containing the files

├── subdir
│   ├── index.html
│   └── test.html

Once I try going to localhost/subdir, the python server redirects me to localhost/sudir/, adding a slash.
The slash should be added by the server. Only the server knows if localhost/subdir is a file or a folder.

Even the official gemini documentation does this. You can do, from your terminal

echo "gemini://geminiprotocol.net" | gnutls-cli --tofu -p 1965 geminiprotocol.net

and you'll see a redirect

31 gemini://geminiprotocol.net/

Now, for some reason Geopard doesn't update the URL after the redirect. So the slash doesn't seem to be added. That's a problem we can work on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants