Skip to content

Commit

Permalink
zip: fix on Windows
Browse files Browse the repository at this point in the history
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 <gobot@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
  • Loading branch information
heschi authored and gopherbot committed Mar 9, 2023
1 parent 69aa7ac commit ad6fd61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion zip/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ func filesInGitRepo(dir, rev, subdir string) ([]File, error) {
if n == "" {
continue
}
n = strings.TrimPrefix(n, string(filepath.Separator))
n = strings.TrimPrefix(n, "/")

fs = append(fs, zipFile{
name: n,
Expand Down
2 changes: 1 addition & 1 deletion zip/zip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ c/`)))
}
wantMap := map[string]bool{}
for _, f := range tc.wantFiles {
p := filepath.Join("example.com", "foo", "bar@v0.0.1", f)
p := path.Join("example.com", "foo", "bar@v0.0.1", f)
wantMap[p] = true
}

Expand Down

0 comments on commit ad6fd61

Please sign in to comment.