💩 update getFileExt
This commit is contained in:
parent
c6226d4a09
commit
687f95c7e9
@ -7,6 +7,7 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -63,11 +64,11 @@ func GetFileContentType(file multipart.File) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getFileExt(name string) string {
|
func getFileExt(name string) string {
|
||||||
results := strings.Split(name, ".")
|
ext := filepath.Ext(name)
|
||||||
if len(results) == 1 {
|
if len(ext) == 0 {
|
||||||
return "undefined"
|
ext = "undefined"
|
||||||
}
|
}
|
||||||
return results[len(results)-1]
|
return ext
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user