~sircmpwn/gmni-devel

a: add slash to end of url when going up a directory v98 PROPOSED

William Casarin: 1
 add slash to end of url when going up a directory

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/gmni-devel/patches/25264/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH av98] add slash to end of url when going up a directory Export this patch

Some server software, such as gmnisrv, return "Not Found" when
requesting:

	gemini://jb55.com/log

instead of

	gemini://jb55.com/log/

This adds a forward slash to the route when going up a directory.

Signed-off-by: William Casarin <jb55@jb55.com>
---

Hey Solderpunk & gmnisrv devs,

I noticed the `up` functionality wasn't working in av98. Should this be
a fix in clients such as av98 or should gmnisrv work without ending
slashes on urls?

Cheers,
Will

 av98.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/av98.py b/av98.py
index f74b532..bad2c56 100755
--- a/av98.py
+++ b/av98.py
@@ -147,7 +147,7 @@ class GeminiItem():
            return self
        # Get rid of bottom component
        pathbits.pop()
        new_path = os.path.join(*pathbits)
        new_path = os.path.join(*pathbits) + "/"
        return GeminiItem(self._derive_url(new_path))

    def query(self, query):
-- 
2.32.0
> Some server software, such as gmnisrv, return "Not Found" when
> requesting:
> 
> gemini://jb55.com/log
> 
> instead of
> 
> gemini://jb55.com/log/
> 
> I noticed the `up` functionality wasn't working in av98. Should this be
> a fix in clients such as av98
I would give an opinionated "Yes" to this question.
AFAIK, there's no specification for how "up" should work,
though since Mozz suggested it, taking hints from his server's implementation
might be a reasonable choice for client implementations.

gemini://mozz.us/journal/2021-01-01.gmi

(/journal redirects to /journal/, suggesting trailing slash should be used)
> or
(and/or)
> should gmnisrv work without ending slashes on urls?
In https://lists.sr.ht/~sircmpwn/gmni-devel/%3C20201219230730.3211241-1-zachdecook%40librem.one%3E
I suggest that we automatically add the trailing slash for autoindex
pages to work.

The link on this auto-indexed page doesn't work,
unless you load it with a trailing slash.

gemini://wiki.zachdecook.com/gemini-protocol

So, while the question could be framed
"should we deal bad client-implementations of an unspecified functionality",
I wouldn't see anything wrong with adding the redirect functionality
provided it doesn't interfere with cgi=on routes.

(the alternative solution for consistency would be
to make the previous link "51 Not Found" instead)

-Zach