filter extensions for HandleMedia

This commit is contained in:
orangix
2026-01-30 04:04:53 +01:00
parent c208a55f40
commit 3b95e89fa1
2 changed files with 11 additions and 5 deletions

View File

@@ -129,7 +129,14 @@ func main() {
r.SetPathValue("postID", component)
return pages.HandleGifv(w, r)
case strings.Contains(component, "."):
return pages.HandleMedia(w, r)
baseName, extension := utils.SplitNameExt(r.PathValue("component"))
r.SetPathValue("baseName", baseName)
r.SetPathValue("extension", extension)
switch extension {
case "png", "gif", "jpg", "jpeg", "webp":
return pages.HandleMedia(w, r)
}
fallthrough
default:
r.SetPathValue("postID", component)
return pages.HandlePost(w, r)