From f9fd4a545719ac564d56e36bb99efee7785b0298 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 10 Nov 2023 13:30:13 +0100 Subject: [PATCH 1/3] fix: gateway panic because of overshadowed err --- gateway/blocks_backend.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gateway/blocks_backend.go b/gateway/blocks_backend.go index b4dd705d2..a87b05c6b 100644 --- a/gateway/blocks_backend.go +++ b/gateway/blocks_backend.go @@ -296,8 +296,8 @@ func (bb *BlocksBackend) Head(ctx context.Context, path path.ImmutablePath) (Con var emptyRoot = []cid.Cid{cid.MustParse("bafkqaaa")} func (bb *BlocksBackend) GetCAR(ctx context.Context, p path.ImmutablePath, params CarParams) (ContentPathMetadata, io.ReadCloser, error) { - pathMetadata, err := bb.ResolvePath(ctx, p) - if err != nil { + pathMetadata, resolveErr := bb.ResolvePath(ctx, p) + if resolveErr != nil { rootCid, err := cid.Decode(strings.Split(p.String(), "/")[2]) if err != nil { return ContentPathMetadata{}, nil, err @@ -327,8 +327,11 @@ func (bb *BlocksBackend) GetCAR(ctx context.Context, p path.ImmutablePath, param LastSegment: path.FromCid(rootCid), ContentType: "", }, io.NopCloser(&buf), nil + } else if err != nil { + return ContentPathMetadata{}, nil, err + } else { + return ContentPathMetadata{}, nil, resolveErr } - return ContentPathMetadata{}, nil, err } if p.Namespace() != path.IPFSNamespace { From 786792f0faee18c3b0c8134858b1d90407d10351 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 10 Nov 2023 13:32:08 +0100 Subject: [PATCH 2/3] docs: changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b2072a5..a0a294159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,10 +19,13 @@ The following emojis are used to highlight certain changes: ### Changed ### Removed + * 🛠 `boxo/gateway`: removed support for undocumented legacy `ipfs-404.html`. Use [`_redirects`](https://specs.ipfs.tech/http-gateways/web-redirects-file/) instead. ### Fixed +* `boxo/gateway`: a request-only panic could sporadically be triggered inside a CAR request, if the right [conditions were met](/~https://github.com/ipfs/boxo/pull/511). + ### Security ## [v0.15.0] From a2c5d356f2f66ce3705b553bbdc34d9ca31fa87e Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 10 Nov 2023 14:31:56 +0100 Subject: [PATCH 3/3] docs: changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0a294159..30d50e9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ The following emojis are used to highlight certain changes: ### Fixed -* `boxo/gateway`: a request-only panic could sporadically be triggered inside a CAR request, if the right [conditions were met](/~https://github.com/ipfs/boxo/pull/511). +* `boxo/gateway`: a panic (which is recovered) could sporadically be triggered inside a CAR request, if the right [conditions were met](/~https://github.com/ipfs/boxo/pull/511). ### Security