From d724f112970af973b4bdbc91a9a3a26fd0d30605 Mon Sep 17 00:00:00 2001 From: zx9597446 Date: Thu, 17 Aug 2023 12:07:07 +0800 Subject: [PATCH] Here is the English translation: If there are directories in a zip file compressed on the Windows platform, the "\\" in the filepath will cause the files to be extracted normally on Linux, and ls will show filenames containing single quotes. So when compressing, I replace "\\" with "/" so that it seems there are no issues on both Windows and Linux. --- src/utils/utils.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/utils.go b/src/utils/utils.go index f85ddcb..602b71d 100644 --- a/src/utils/utils.go +++ b/src/utils/utils.go @@ -402,6 +402,7 @@ func ZipDirectory(destination string, source string) (err error) { } defer f1.Close() zipPath := strings.ReplaceAll(path, source, strings.TrimSuffix(destination, ".zip")) + zipPath = filepath.ToSlash(zipPath) w1, err := writer.Create(zipPath) if err != nil { log.Fatalln(err)