bugs after refactor
This commit is contained in:
parent
d9602f5c48
commit
712d35ae4d
1 changed files with 11 additions and 11 deletions
22
main.go
22
main.go
|
@ -140,22 +140,22 @@ func process(_ context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
renderFeed(w, r, client)
|
renderFeed(w, r, client)
|
||||||
case regexp.MustCompile(`^/a/?$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/a/?$`).MatchString(r.URL.Path):
|
||||||
renderAbout(w)
|
renderAbout(w)
|
||||||
case regexp.MustCompile(`^/(` + langs + `)/s/?$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/s/?$`).MatchString(r.URL.Path):
|
||||||
renderSearch(lang, w, r, client)
|
renderSearch(w, r, client)
|
||||||
case regexp.MustCompile(`^/(` + langs + `)/f/?$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/f/?$`).MatchString(r.URL.Path):
|
||||||
renderAllFiles(lang, w, client)
|
renderAllFiles(w, client)
|
||||||
case regexp.MustCompile(`^/(` + langs + `)/f/([\p{L}\d_+.]+/)+[\d\w]+/index.gmi$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/f/([\p{L}\d_+.]+/)+[\d\w]+/index.gmi$`).MatchString(r.URL.Path):
|
||||||
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)-2)], "/"),
|
strings.Join(urlParts[:(len(urlParts)-2)], "/"),
|
||||||
)
|
)
|
||||||
case regexp.MustCompile(`^/(` + langs + `)/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(lang, w, r, client)
|
renderFile(w, r, client)
|
||||||
case regexp.MustCompile(`^/(` + langs + `)/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path):
|
||||||
renderCategory(lang, w, r, client)
|
renderCategory(w, r, client)
|
||||||
case regexp.MustCompile(`^/(` + langs + `)/t/[\p{L}\d_+.]+/?$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/t/[\p{L}\d_+.]+/?$`).MatchString(r.URL.Path):
|
||||||
renderTag(lang, w, r, client)
|
renderTag(w, r, client)
|
||||||
case regexp.MustCompile(`^/__a/`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/__a/`).MatchString(r.URL.Path):
|
||||||
downloadAttachment(w, r, client)
|
downloadAttachment(w, r, client)
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue