]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/go/internal/modfetch: avoid path.Join in URL errors, part 2
authorDmitri Shuralyov <dmitshur@golang.org>
Sun, 1 Oct 2023 20:03:01 +0000 (16:03 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 2 Nov 2023 19:15:05 +0000 (19:15 +0000)
CL 406675 added more detail to bare errors from net/http in two places.
CL 461682 improved one of the two places to stop folding "//" into "/".
This CL applies the same change to the other place.

For #52727.

Change-Id: I3fc13f30cf0f054949ce78269c52b7fafd477e70
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/532015
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/go/internal/modfetch/proxy.go

index dd37ba98f2b520ebd5690b8d6b1ce45faa03b9d6..56a6aaa40d9c09ae681aa7bd6069b53b3c06c9a6 100644 (file)
@@ -432,7 +432,7 @@ func (p *proxyRepo) Zip(ctx context.Context, dst io.Writer, version string) erro
        if _, err := io.Copy(dst, lr); err != nil {
                // net/http doesn't add context to Body errors, so add it here.
                // (See https://go.dev/issue/52727.)
-               err = &url.Error{Op: "read", URL: pathpkg.Join(p.redactedURL, path), Err: err}
+               err = &url.Error{Op: "read", URL: strings.TrimSuffix(p.redactedURL, "/") + "/" + path, Err: err}
                return p.versionError(version, err)
        }
        if lr.N <= 0 {