diff --git a/main.go b/main.go index f62e2b4..e7e7b35 100644 --- a/main.go +++ b/main.go @@ -148,7 +148,7 @@ func process(_ context.Context, w gemini.ResponseWriter, r *gemini.Request) { urlParts := strings.Split(r.URL.Path, "/") w.WriteHeader( gemini.StatusPermanentRedirect, - strings.Join(urlParts[:(len(urlParts)-1)], "/"), + strings.Join(urlParts[:(len(urlParts)-2)], "/"), ) case regexp.MustCompile(`^/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path): renderFile(w, r, client) @@ -439,7 +439,7 @@ func renderAllFiles(w gemini.ResponseWriter, client TreeManagerClient) { func renderTag(w gemini.ResponseWriter, r *gemini.Request, client TreeManagerClient) { urlParts := strings.Split(strings.Trim(r.URL.Path, "/"), "/") - tag := urlParts[len(urlParts)] + tag := urlParts[len(urlParts)-1] tagFilter := TreeRequest_Filter{Key: "tag", Value: tag} filters := []*TreeRequest_Filter{&tagFilter}