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: IPFS gateway should return only json content #174

Merged
merged 1 commit into from
Sep 7, 2023
Merged

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Sep 6, 2023

🧿 Current issues / What's wrong ?

The /ipfs/* endpoint is currently returning json content.

But when the given CID is something else than a JSON file, the endpoint fail, with a timeout error (await response.json() is timing out)

💊 Fixes / Solution

  • Return a 400 error when the content-type is not a json file

🚧 Changes

  • reject the promise when the content-type is not matching a json content type
  • reject the promise when parsing the body as json is failing.

🛠️ Tests

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

utACK

@wa0x6e wa0x6e merged commit b5a7507 into master Sep 7, 2023
2 checks passed
@wa0x6e wa0x6e deleted the fix-172 branch September 7, 2023 02:14
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.

2 participants