Use content type from request only if not empty

This commit is contained in:
x3 2024-02-28 14:30:14 +01:00
parent 81fa050147
commit d3c07e1dc1
Signed by: x3
GPG Key ID: 7E9961E8AD0E240E
1 changed files with 4 additions and 1 deletions

View File

@ -113,7 +113,10 @@ func Upload(w http.ResponseWriter, r *http.Request) {
file.Read(b)
fType := http.DetectContentType(b)
if fType == "application/octet-stream" {
fType = fheader.Header.Get("Content-Type")
hType := fheader.Header.Get("Content-Type")
if hType != "" {
fType = hType
}
}
resId, tx, err := db.Db.InsertFile(fheader.Filename, fheader.Size, fType, sum, auth)