mbrubeck / agate

Very simple server for the Gemini hypertext protocol
Apache License 2.0
605 stars 37 forks source link

Support for symlinks #60

Closed GoodClover closed 3 years ago

GoodClover commented 3 years ago

At current, if you add a symlink in the content folder then agate just sees it as a file. It would be nice if symlinks were understood by agate and seen as folders.

My goal was to create a symlink to my ~/sync/Docs/public folder inside my content folder, so that I didn't have to copy files across that I want to be public.

Example of current behaviour: my capsule (gemini://goodclover.xyz/files/) has a Documents item, which is the symlink to the folder I mentioned above. Trying to access it gives a 51 Not found.

GoodClover commented 3 years ago

In the log I get

[2021-06-05T19:11:45Z WARN  agate] [::ffff:my.local.ip.addr]:1965 - "gemini://goodclover.xyz/files/Documents/" 51 "Not found, sorry." error:No such file or directory (os error 2)

when you try to access the symlink.

Johann150 commented 3 years ago

Thank you for your issue. I added some test cases to check that symlinked files and symlinked directories work. Both of these tests pass correctly.

The error you show could also be returned if there is no index.gmi file and directory listing is not enabled. See https://github.com/mbrubeck/agate#directory-listing. Is that maybe the issue in your case?

Johann150 commented 3 years ago

I have added more appropriate error messages for when indexing is turned off and there is no index.gmi file. If you try again with v3.1.0, you should get a different error now.

GoodClover commented 3 years ago

Ahh, I'm an idiot! 😅 It will have been that, I'm away from my computer till tomorrow so I can't check but that makes total sense.

Glad to see it's led to tests being added and a better error message though 😃

Johann150 commented 3 years ago

I think alone for that the name "idiot" is inappropriate! 😀👍

If this was it, I'll go ahead and close this issue. If it still doesn't work, you can comment again and I can look into it more.