finish banned mime types

This commit is contained in:
2026-11-15 12:15:02 -05:00
parent e1e0c8042e
commit 2a315a68fc
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -15,6 +15,7 @@ import (
"net/http"
"os"
"path/filepath"
"slices"
"strings"
"time"
"unicode/utf8"
@@ -119,6 +120,10 @@ func uploadHandler(db *gorm.DB, cfg Config, pages *template.Template, qts []stri
http.Error(w, "failed to detect mime type", http.StatusInternalServerError)
return
}
if slices.Contains(cfg.BannedMIMETypes, input.MIMEType) {
http.Error(w, "content type not allowed", http.StatusBadRequest)
return
}
input.Reader = file
input.Filename = header.Filename
input.Type = ContentFile