From 1c9eb97ab797b266a5d335315cc297e4e7653f1c Mon Sep 17 00:00:00 2001 From: chamilaadhi Date: Thu, 14 Nov 2019 17:23:13 +0530 Subject: [PATCH] Fix import issue on linux server when using cli from windows --- import-export-cli/utils/zipUtils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/import-export-cli/utils/zipUtils.go b/import-export-cli/utils/zipUtils.go index ae4e096c0..054473be4 100644 --- a/import-export-cli/utils/zipUtils.go +++ b/import-export-cli/utils/zipUtils.go @@ -66,7 +66,10 @@ func Zip(source, target string) error { // If baseDir is not empty it means we need to strip source from path, so we can get a relative filename from // base. if baseDir != "" { - header.Name = filepath.Join(baseDir, strings.TrimPrefix(path, source)) + // Replace system specific path seperator with forward slash '/' as the separator as required by the + // ZIP spec (4.4.17.1) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT + var resource string = filepath.Join(baseDir, strings.TrimPrefix(path, source)) + header.Name = strings.ReplaceAll(resource, string(filepath.Separator), "/") } if info.IsDir() { // add directory to zip archive