改新活动

This commit is contained in:
2023-02-24 20:41:47 +08:00
parent 30255dfccc
commit 8f51e7a8dc
8 changed files with 67 additions and 9 deletions

16
pkg/util/util.go Normal file
View File

@@ -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("扩展名不支持")
}
}