finish banned mime types
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user