diff --git a/archiver/archive.go b/archiver/archive.go index 370831de0..b773b635d 100644 --- a/archiver/archive.go +++ b/archiver/archive.go @@ -93,7 +93,7 @@ func buildArchiveHeader(info os.FileInfo, relativePath string) (*zip.FileHeader, } header.Method = zip.Deflate - header.Name = relativePath + header.Name = filepath.ToSlash(relativePath) if info.IsDir() && !strings.HasSuffix(header.Name, "/") { header.Name = header.Name + "/" } diff --git a/main_test.go b/main_test.go index a76126231..1dc98a8ab 100644 --- a/main_test.go +++ b/main_test.go @@ -689,10 +689,7 @@ func listArchivedFiles(t *testing.T, body []byte) []byte { var listing bytes.Buffer for _, f := range zipReader.File { - // f.Name is populated from the zip file directly and is not validated for correctness. - // Using filepath.ToSlash(f.Name) ensures that the file name has the expected format - // regardless of the OS. - listing.WriteString(fmt.Sprintf("%d %s\n", f.UncompressedSize64, filepath.ToSlash(f.Name))) + listing.WriteString(fmt.Sprintf("%d %s\n", f.UncompressedSize64, f.Name)) } return listing.Bytes() }