From c8c646d31bec3cbe56ecf5a26fbbd235c97cfb21 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 13 Jan 2023 16:43:41 -0500 Subject: [PATCH] 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 Run-TryBot: Bryan Mills Auto-Submit: Bryan Mills Reviewed-by: Ian Lance Taylor --- src/cmd/go/internal/modfetch/proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/go/internal/modfetch/proxy.go b/src/cmd/go/internal/modfetch/proxy.go index d2374680d8..facf738cb0 100644 --- a/src/cmd/go/internal/modfetch/proxy.go +++ b/src/cmd/go/internal/modfetch/proxy.go @@ -262,7 +262,7 @@ func (p *proxyRepo) getBytes(path string) ([]byte, error) { if err != nil { // net/http doesn't add context to Body errors, so add it here. // (See https://go.dev/issue/52727.) - return b, &url.Error{Op: "read", URL: pathpkg.Join(p.redactedURL, path), Err: err} + return b, &url.Error{Op: "read", URL: strings.TrimSuffix(p.redactedURL, "/") + "/" + path, Err: err} } return b, nil }