Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion archiver/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "/"
}
Expand Down
5 changes: 1 addition & 4 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down