Skip to content

Commit c8c646d

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
cmd/go/internal/modfetch: avoid path.Join in URL errors
path.Join collapses duplicated '/' tokens, but an HTTP URL intentionally includes a '://' after the scheme. This should fix the syntax of the errors seen in https://build.golang.org/log/a17d0c7b6159ea4dad0a9e5378ab5a36ee30ce44. Updates #52727. Change-Id: I6e1773a7eb8b3e7e2b3ca29540c1e94a7cd2d99d Reviewed-on: https://go-review.googlesource.com/c/go/+/461682 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Bryan Mills <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent a106def commit c8c646d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/cmd/go/internal/modfetch/proxy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (p *proxyRepo) getBytes(path string) ([]byte, error) {
262262
if err != nil {
263263
// net/http doesn't add context to Body errors, so add it here.
264264
// (See https://go.dev/issue/52727.)
265-
return b, &url.Error{Op: "read", URL: pathpkg.Join(p.redactedURL, path), Err: err}
265+
return b, &url.Error{Op: "read", URL: strings.TrimSuffix(p.redactedURL, "/") + "/" + path, Err: err}
266266
}
267267
return b, nil
268268
}

0 commit comments

Comments
 (0)