fileupload: append ext to filename if missing

This commit is contained in:
Simon Ser 2024-03-11 10:46:48 +01:00
parent 349e19876c
commit 185f6ae3bd

View file

@ -43,7 +43,7 @@ func (fs *fs) store(r io.Reader, username, mimeType, origBasename string) (outFi
origBasename = filepath.Base(origBasename)
var suffix string
if origBasename == "" && mimeType != "" {
if filepath.Ext(origBasename) == "" && mimeType != "" {
exts, _ := mime.ExtensionsByType(mimeType)
if len(exts) > 0 {
suffix = exts[0]