Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gateway): ipld.ErrNotFound should result in a 404 #630

Merged
merged 4 commits into from
Jul 30, 2024

Conversation

MichaelMure
Copy link
Contributor

Fix #593

In case of blockstore restriction like with --offline or similar restriction, returning a 500 is inapropriate.

It's also going back to a previous gateway behavior (at least in kubo v0.22, possibly later).

In case of blockstore restriction like with --offline or similar restriction, returning a 500 is inapropriate.

It's also going back to a previous gateway behavior (at least in kubo v0.22, possibly later).
@MichaelMure MichaelMure requested review from lidel, hacdias and a team as code owners June 24, 2024 09:10
@lidel lidel self-assigned this Jul 30, 2024
lidel added a commit to ipfs/kubo that referenced this pull request Jul 30, 2024
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this @MichaelMure. Took bit longer to review as the semantic meaning of this ipld error type changed multiple times over the years, and we also had big refactor since v0.22, but it seems to do the trick with how things are today.

Tested in ipfs/kubo#10466 and lgtm (we had NoFetch tests that expected 500, changed them to 404).
Sharness tests failing here can be ignored (circular dep, will clear up once we ship releases in both places).

This will be included in Kubo 0.30 (ipfs/kubo#10436).

@lidel lidel merged commit 8e51658 into ipfs:main Jul 30, 2024
11 of 12 checks passed
lidel added a commit to ipfs/kubo that referenced this pull request Jul 30, 2024
commit from upstream repo, includes
ipfs/boxo#630
@lidel lidel mentioned this pull request Jul 30, 2024
4 tasks
lidel added a commit to ipfs/kubo that referenced this pull request Jul 30, 2024
lidel added a commit to ipfs/kubo that referenced this pull request Jul 30, 2024
* chore: go get -u
* fix(gateway): return 404 in no-fetch contexts (#10466)

applies and tests fix from ipfs/boxo#630
wenyue pushed a commit to wenyue/boxo that referenced this pull request Oct 17, 2024
* fix(gateway): ipld.ErrNotFound should result in a 404

In case of blockstore restriction like with --offline or similar restriction, returning a 500 is inappropriate.

It's also going back to a previous gateway behavior (at least in kubo v0.22, possibly later).

* refactor(gateway): match 410 before 404s

just a precaution to ensure 410 takes precedence, until we address
ipfs#591

* docs: clarify 404 use case

---------

Co-authored-by: Marcin Rataj <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gateway: ipld.ErrNotFound should result in a 404
2 participants