unzip 버그 수정 - 백슬래시 처리 추가
This commit is contained in:
@ -55,6 +55,9 @@ func download(dir string, urlpath string, accessToken string) (string, error) {
|
||||
return filepath.ToSlash(out.Name()), nil
|
||||
}
|
||||
|
||||
func UnzipTest(fname string) error {
|
||||
return unzip(fname)
|
||||
}
|
||||
func unzip(fname string) error {
|
||||
archive, err := zip.OpenReader(fname)
|
||||
if err != nil {
|
||||
@ -75,10 +78,12 @@ func unzip(fname string) error {
|
||||
name = f.Name
|
||||
}
|
||||
|
||||
name = strings.ReplaceAll(name, `\`, "/")
|
||||
filePath := path.Join(verpath, name)
|
||||
|
||||
if f.FileInfo().IsDir() {
|
||||
os.MkdirAll(filePath, 0775)
|
||||
if f.FileInfo().IsDir() || strings.HasSuffix(f.FileInfo().Name(), `\`) {
|
||||
if err = os.MkdirAll(filePath, 0775); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user