1
0
mirror of https://github.com/gogf/gf.git synced 2025-04-05 03:05:05 +08:00

Update gcompress_zip.go (#2694)

Fix index out of range when zipfile has dir __MAXOSX
This commit is contained in:
rexxar5188 2023-06-12 20:46:31 +08:00 committed by GitHub
parent 842e5a6774
commit 46f3196297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,7 +175,7 @@ func unZipFileWithReader(reader *zip.Reader, dstFolderPath string, zippedPrefix
name = gstr.Replace(file.Name, `\`, `/`)
name = gstr.Trim(name, "/")
if prefix != "" {
if name[0:len(prefix)] != prefix {
if !strings.HasPrefix(name, prefix) {
continue
}
name = name[len(prefix):]