mirror of
https://github.com/HChaZZY/alist.git
synced 2025-12-15 22:56:27 +08:00
fix(webdav): set mime by ext if it's empty
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -136,3 +137,12 @@ func GetFileType(filename string) int {
|
||||
}
|
||||
return conf.UNKNOWN
|
||||
}
|
||||
|
||||
func GetMimeType(name string) string {
|
||||
ext := path.Ext(name)
|
||||
m := mime.TypeByExtension(ext)
|
||||
if m != "" {
|
||||
return m
|
||||
}
|
||||
return "application/octet-stream"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user