Files
integrity-checkin/pkg/util/util.go
2023-02-24 20:52:08 +08:00

17 lines
317 B
Go

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", ".txt":
return nil
default:
return errors.New("扩展名不支持")
}
}