fileupload: append ext to filename if missing
This commit is contained in:
parent
349e19876c
commit
185f6ae3bd
|
@ -43,7 +43,7 @@ func (fs *fs) store(r io.Reader, username, mimeType, origBasename string) (outFi
|
||||||
origBasename = filepath.Base(origBasename)
|
origBasename = filepath.Base(origBasename)
|
||||||
|
|
||||||
var suffix string
|
var suffix string
|
||||||
if origBasename == "" && mimeType != "" {
|
if filepath.Ext(origBasename) == "" && mimeType != "" {
|
||||||
exts, _ := mime.ExtensionsByType(mimeType)
|
exts, _ := mime.ExtensionsByType(mimeType)
|
||||||
if len(exts) > 0 {
|
if len(exts) > 0 {
|
||||||
suffix = exts[0]
|
suffix = exts[0]
|
||||||
|
|
Loading…
Reference in a new issue