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(route): handle /api/v0/name/resolve/arg #63

Merged
merged 2 commits into from
Jan 29, 2024
Merged

Conversation

ns4plabs
Copy link
Contributor

No description provided.

Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

Hmmm, Kubo does not support the trailing slash. Did we ever support this in the public gateways?

curl -I -X POST "http://127.0.0.1:5001/api/v0/name/resolve?arg=ipfs.tech"
HTTP/1.1 200 OK
curl -I -X POST "http://127.0.0.1:5001/api/v0/name/resolve/?arg=ipfs.tech"
HTTP/1.1 500 Internal Server Error

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.

I think both were technically allowed by https://github.com/ipfs/go-ipfs-cmds/ and Kubo:

$ curl "http://127.0.0.1:8080/api/v0/name/resolve/ipfs.tech"
{"Path":"/ipfs/Qmb3zPY1qxAB5Jha4jWVRqkPxAdnukJUtNAjC7GMfyTdhj"}

$ curl "http://127.0.0.1:8080/api/v0/name/resolve?arg=ipfs.tech"
{"Path":"/ipfs/Qmb3zPY1qxAB5Jha4jWVRqkPxAdnukJUtNAjC7GMfyTdhj"}

but can't use both notations at the same time:

$ curl "http://127.0.0.1:8080/api/v0/name/resolve/?arg=ipfs.tech"
{"Message":"invalid path \"/ipns/\": path does not have enough components","Code":0,"Type":"error"}

iirc trailing slash means arg is the terminus of the path, so you can't pass arg as arg and have trailing slash at the same time (fix below)

handler_test.go Outdated Show resolved Hide resolved
@lidel lidel changed the title legacy rpc: handle /api/v0/name/resolve/ fix(route): handle /api/v0/name/resolve/arg Jan 29, 2024
@lidel lidel merged commit c5d0b21 into ipfs:main Jan 29, 2024
10 checks passed
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.

3 participants