改新活动
此提交包含在:
16
pkg/util/util.go
一般檔案
16
pkg/util/util.go
一般檔案
@@ -0,0 +1,16 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func ValidateFilename(filename string) error {
|
||||
switch filepath.Ext(filename) {
|
||||
case ".pdf", ".doc", ".jpg", ".gif", ".png", ".jpeg",
|
||||
".docx", ".xls", ".xlsx", ".zip", ".rar", ".7z":
|
||||
return nil
|
||||
default:
|
||||
return errors.New("扩展名不支持")
|
||||
}
|
||||
}
|
新增問題並參考
封鎖使用者