url path fix #2
This commit is contained in:
parent
e1fe33ce46
commit
81c5db91f3
1 changed files with 2 additions and 2 deletions
4
main.go
4
main.go
|
@ -148,7 +148,7 @@ func process(_ context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
urlParts := strings.Split(r.URL.Path, "/")
|
urlParts := strings.Split(r.URL.Path, "/")
|
||||||
w.WriteHeader(
|
w.WriteHeader(
|
||||||
gemini.StatusPermanentRedirect,
|
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):
|
case regexp.MustCompile(`^/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path):
|
||||||
renderFile(w, r, client)
|
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) {
|
func renderTag(w gemini.ResponseWriter, r *gemini.Request, client TreeManagerClient) {
|
||||||
urlParts := strings.Split(strings.Trim(r.URL.Path, "/"), "/")
|
urlParts := strings.Split(strings.Trim(r.URL.Path, "/"), "/")
|
||||||
tag := urlParts[len(urlParts)]
|
tag := urlParts[len(urlParts)-1]
|
||||||
tagFilter := TreeRequest_Filter{Key: "tag", Value: tag}
|
tagFilter := TreeRequest_Filter{Key: "tag", Value: tag}
|
||||||
filters := []*TreeRequest_Filter{&tagFilter}
|
filters := []*TreeRequest_Filter{&tagFilter}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue