Skip to content

Commit ad6fd61

Browse files
heschigopherbot
authored andcommitted
zip: fix on Windows
Zip paths are slash-delimited, so using filepath with them is incorrect. Change-Id: I5ad1ee90dea97427b9b291b6fbc52e5bdaf0b678 Reviewed-on: https://go-review.googlesource.com/c/mod/+/474815 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent 69aa7ac commit ad6fd61

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

zip/zip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ func filesInGitRepo(dir, rev, subdir string) ([]File, error) {
663663
if n == "" {
664664
continue
665665
}
666-
n = strings.TrimPrefix(n, string(filepath.Separator))
666+
n = strings.TrimPrefix(n, "/")
667667

668668
fs = append(fs, zipFile{
669669
name: n,

zip/zip_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ c/`)))
15321532
}
15331533
wantMap := map[string]bool{}
15341534
for _, f := range tc.wantFiles {
1535-
p := filepath.Join("example.com", "foo", "[email protected]", f)
1535+
p := path.Join("example.com", "foo", "[email protected]", f)
15361536
wantMap[p] = true
15371537
}
15381538

0 commit comments

Comments
 (0)