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)
|
||||
case regexp.MustCompile(`^/a/?$`).MatchString(r.URL.Path):
|
||||
renderAbout(w)
|
||||
case regexp.MustCompile(`^/(` + langs + `)/s/?$`).MatchString(r.URL.Path):
|
||||
renderSearch(lang, w, r, client)
|
||||
case regexp.MustCompile(`^/(` + langs + `)/f/?$`).MatchString(r.URL.Path):
|
||||
renderAllFiles(lang, w, client)
|
||||
case regexp.MustCompile(`^/(` + langs + `)/f/([\p{L}\d_+.]+/)+[\d\w]+/index.gmi$`).MatchString(r.URL.Path):
|
||||
case regexp.MustCompile(`^/s/?$`).MatchString(r.URL.Path):
|
||||
renderSearch(w, r, client)
|
||||
case regexp.MustCompile(`^/f/?$`).MatchString(r.URL.Path):
|
||||
renderAllFiles(w, client)
|
||||
case regexp.MustCompile(`^/f/([\p{L}\d_+.]+/)+[\d\w]+/index.gmi$`).MatchString(r.URL.Path):
|
||||
urlParts := strings.Split(r.URL.Path, "/")
|
||||
w.WriteHeader(
|
||||
gemini.StatusPermanentRedirect,
|
||||
strings.Join(urlParts[:(len(urlParts)-2)], "/"),
|
||||
)
|
||||
case regexp.MustCompile(`^/(` + langs + `)/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path):
|
||||
renderFile(lang, w, r, client)
|
||||
case regexp.MustCompile(`^/(` + langs + `)/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path):
|
||||
renderCategory(lang, w, r, client)
|
||||
case regexp.MustCompile(`^/(` + langs + `)/t/[\p{L}\d_+.]+/?$`).MatchString(r.URL.Path):
|
||||
renderTag(lang, w, r, client)
|
||||
case regexp.MustCompile(`^/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path):
|
||||
renderFile(w, r, client)
|
||||
case regexp.MustCompile(`^/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path):
|
||||
renderCategory(w, r, client)
|
||||
case regexp.MustCompile(`^/t/[\p{L}\d_+.]+/?$`).MatchString(r.URL.Path):
|
||||
renderTag(w, r, client)
|
||||
case regexp.MustCompile(`^/__a/`).MatchString(r.URL.Path):
|
||||
downloadAttachment(w, r, client)
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue