mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
(goctl)fix code_ql (#4009)
This commit is contained in:
parent
bbce95e7e1
commit
3e794cf991
@ -16,10 +16,15 @@ func Unpacking(name, destPath string, mapper func(f *zip.File) bool) error {
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
destAbsPath, err := filepath.Abs(destPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, file := range r.File {
|
||||
ok := mapper(file)
|
||||
if ok {
|
||||
err = fileCopy(file, destPath)
|
||||
err = fileCopy(file, destAbsPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -34,7 +39,12 @@ func fileCopy(file *zip.File, destPath string) error {
|
||||
return err
|
||||
}
|
||||
defer rc.Close()
|
||||
filename := filepath.Join(destPath, filepath.Base(file.Name))
|
||||
abs, err := filepath.Abs(file.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
filename := filepath.Join(destPath, filepath.Base(abs))
|
||||
dir := filepath.Dir(filename)
|
||||
err = pathx.MkdirIfNotExist(dir)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user