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 in HTTP+HTML mode seem to not originate from current directory #9

Closed
waweic opened this issue Jun 12, 2020 · 7 comments
Labels
bug Something isn't working

Comments

@waweic
Copy link

waweic commented Jun 12, 2020

Current URI: "http://example.com/somedirectory"
Href attribute of clicked link: "somesite.html"
URI kristall is trying to access: "http://example.com/somesite.html"
Expected URI: "http://example.com/somedirectory/somesite.html"

Update:
When the current URI has either a "/" or a filename at the end, it does seem to work. The current problem seems to be the name of the folder that does not end with a "/"

@ikskuh ikskuh added the bug Something isn't working label Jun 14, 2020
@ikskuh
Copy link
Owner

ikskuh commented Jun 19, 2020

I cannot reproduce this, can you show me a real-world example?

My test file (/html/rel.htm) is:

<!doctype html>
<html>
  <body>
    <a href="../text/utf-8.txt">../text/utf-8.txt</a>
    <a href="/text/utf-8.txt">/text/utf-8.txt</a>
    
  </body>
</html>

Both links resolve to the same file, both served via gemini and http

@waweic
Copy link
Author

waweic commented Jul 1, 2020

Sorry I'm late with my reply, I have now put up an example on a page of mine.

This link does work as expected: https://tilde.ism.rocks/~waweic/kristall-relative-link-testbed/ (This one has a trailing /)
This link does not: https://tilde.ism.rocks/~waweic/kristall-relative-link-testbed

@ikskuh
Copy link
Owner

ikskuh commented Jul 1, 2020

Hm, i still cannot reproduce this. Both links work as expected. The first one (trailing /) will yield the index site directly, the other one will react to the redirect from the server and will also land on the site with the trailing /

@waweic
Copy link
Author

waweic commented Jul 2, 2020

The server is not redirecting me. It just delivers the page without the trailing / to the browser. When I access the URL from the second link, the address bar does not have a trailing / in it.

Clicking the link on that website is what only works for me on the page with the trailing /

@ikskuh
Copy link
Owner

ikskuh commented Jul 3, 2020

Please check your redirection settings. Visiting https://tilde.ism.rocks/~waweic/kristall-relative-link-testbed yields

HTTP/2 301 
server: nginx/1.14.0 (Ubuntu)
date: Fri, 03 Jul 2020 08:12:37 GMT
content-type: text/html
content-length: 194
location: https://tilde.ism.rocks/~waweic/kristall-relative-link-testbed/
content-security-policy: default-src 'self'; script-src 'none';

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>

Which is obviously a redirection, whereas visiting https://tilde.ism.rocks/~waweic/kristall-relative-link-testbed/ yields

HTTP/2 200 
server: nginx/1.14.0 (Ubuntu)
date: Fri, 03 Jul 2020 08:13:39 GMT
content-type: text/html; charset=UTF-8
content-length: 92
last-modified: Wed, 01 Jul 2020 11:09:06 GMT
etag: "5efc6ed2-5c"
content-security-policy: default-src 'self'; script-src 'none';
accept-ranges: bytes

<html>
<body>
<a href="site-next-to-index.html">site-next-to-index.html</a>
</body>
</html>

which is the site you're talking about. Kristall is following redirections by default, but you can change this behaviour in the settings

@waweic
Copy link
Author

waweic commented Jul 7, 2020

Sorry. My fault. When I discovered that behaviour, I was using an older version that didn't implement redirections, apparently. I built it from master again, now it's working

@waweic waweic closed this as completed Jul 7, 2020
@ikskuh
Copy link
Owner

ikskuh commented Jul 7, 2020

No worries. It would've been my next question, but bugs can happen everywhere!

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

2 participants