fix扩展名可能为大写
This commit is contained in:
父節點
4048ee982b
當前提交
0dc3aed4fe
@ -3,10 +3,11 @@ package util
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ValidateFilename(filename string) error {
|
func ValidateFilename(filename string) error {
|
||||||
switch filepath.Ext(filename) {
|
switch filepath.Ext(strings.ToLower(filename)) {
|
||||||
case ".pdf", ".doc", ".jpg", ".gif", ".png", ".jpeg",
|
case ".pdf", ".doc", ".jpg", ".gif", ".png", ".jpeg",
|
||||||
".docx", ".xls", ".xlsx", ".zip", ".rar", ".7z", ".txt":
|
".docx", ".xls", ".xlsx", ".zip", ".rar", ".7z", ".txt":
|
||||||
return nil
|
return nil
|
||||||
|
載入中…
x
新增問題並參考
Block a user