mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-02-03 20:26:30 +00:00
simplify SplitNameExt
This commit is contained in:
6
main.go
6
main.go
@@ -87,7 +87,7 @@ func main() {
|
||||
app.Handle("GET /t/{tag}", wrapHandler(func(w http.ResponseWriter, r *http.Request) error {
|
||||
name, ext := utils.SplitNameExt(r.PathValue("tag"))
|
||||
if ext != "" {
|
||||
r.SetPathValue("tag", name[0:len(name)-1])
|
||||
r.SetPathValue("tag", name)
|
||||
r.SetPathValue("type", ext)
|
||||
return pages.HandleTagRSS(w, r)
|
||||
}
|
||||
@@ -98,7 +98,7 @@ func main() {
|
||||
app.Handle("GET /user/{userID}", wrapHandler(func(w http.ResponseWriter, r *http.Request) error {
|
||||
name, ext := utils.SplitNameExt(r.PathValue("userID"))
|
||||
if ext != "" {
|
||||
r.SetPathValue("userID", name[0:len(name)-1])
|
||||
r.SetPathValue("userID", name)
|
||||
r.SetPathValue("type", ext)
|
||||
return pages.HandleUserRSS(w, r)
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func main() {
|
||||
r.SetPathValue("baseName", baseName)
|
||||
r.SetPathValue("extension", extension)
|
||||
switch extension {
|
||||
case "png", "gif", "jpg", "jpeg", "webp", "mp4", "webm":
|
||||
case ".png", ".gif", ".jpg", ".jpeg", ".webp", ".mp4", ".webm":
|
||||
return pages.HandleMedia(w, r)
|
||||
}
|
||||
fallthrough
|
||||
|
||||
Reference in New Issue
Block a user