增加自动化代码选择业务库功能,增加无边框页面功能。 (#1264)
* feat:增加无边框页面路由 * 更改基础页面文字说明 * 修复安装插件路径穿越漏洞 * 添加业务库数据库选择功能 Co-authored-by: dzwvip <dzwvip@qq.com> Co-authored-by: znonymous <fly1029@yeah.net>
This commit is contained in:
committed by
GitHub
co-authored by
dzwvip
znonymous
parent
525b3a0da9
commit
05f8ae2aae
+6
-1
@@ -2,12 +2,14 @@ package utils
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//解压
|
||||
// 解压
|
||||
func Unzip(zipFile string, destDir string) ([]string, error) {
|
||||
zipReader, err := zip.OpenReader(zipFile)
|
||||
var paths []string
|
||||
@@ -17,6 +19,9 @@ func Unzip(zipFile string, destDir string) ([]string, error) {
|
||||
defer zipReader.Close()
|
||||
|
||||
for _, f := range zipReader.File {
|
||||
if strings.Index(f.Name, "../") > -1 {
|
||||
return []string{}, fmt.Errorf("%s 文件名不合法", f.Name)
|
||||
}
|
||||
fpath := filepath.Join(destDir, f.Name)
|
||||
paths = append(paths, fpath)
|
||||
if f.FileInfo().IsDir() {
|
||||
|
||||
Reference in New Issue
Block a user