[fix] 修复安全问题

This commit is contained in:
PandaX
2024-03-11 11:24:37 +08:00
parent 0d3bae0001
commit b30d900663
6 changed files with 32 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ import (
"net/http"
"os"
"pandax/kit/biz"
"path/filepath"
"strconv"
"sync"
)
@@ -130,3 +131,13 @@ func SaveUploadedFile(file *multipart.FileHeader, dst string) error {
_, err = io.Copy(out, src)
return err
}
func IsExcl(fpath string) bool {
ext := filepath.Ext(fpath)
switch ext {
case "xls", "xlsx":
return true
default:
return false
}
}