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

gateway: don't redirect to trailing slash if it's go get #3963

Merged
merged 1 commit into from
Jun 9, 2017

Conversation

ghost
Copy link

@ghost ghost commented Jun 8, 2017

This enables go get to parse go-import meta tags from index.html files stored in IPFS. One tiny step toward whyrusleeping/gx-go#2.

For an import like ipfs.io/ipfs/QmFoo/mypkg, the gateway would previously redirect to /ipfs/QmFoo/mypkg/ (note the trailing slash), which the go get tool can't deal with. Thankfully, go get sets a URL query parameter (?go-get=1) which we can use to switch off the redirect in this case.

This enables `go get` to parse go-import meta tags from index.html
files stored in IPFS. One tiny step toward whyrusleeping/gx-go#2.

For an import like `ipfs.io/ipfs/QmFoo/mypkg`, the gateway would
previously redirect to `/ipfs/QmFoo/mypkg/` (note the trailing slash),
which the `go get` tool can't deal with.

Thankfully, `go get` sets a URL query parameter (`?go-get=1`) which
we can use to switch off the redirect in this case.

License: MIT
Signed-off-by: Lars Gierth <[email protected]>
@ghost ghost added the topic/gateway Topic gateway label Jun 8, 2017
@ghost ghost requested a review from Kubuxu June 8, 2017 01:24
@ghost ghost added the status/in-progress In progress label Jun 8, 2017
Copy link
Member

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @lgierth :)

@whyrusleeping whyrusleeping merged commit 67828a4 into master Jun 9, 2017
@whyrusleeping whyrusleeping deleted the feat/gateway-go-get branch June 9, 2017 04:00
lidel added a commit that referenced this pull request Jul 18, 2022
This adds a missing test for #3963
lidel added a commit that referenced this pull request Jul 18, 2022
This adds a missing test for #3963
lidel added a commit that referenced this pull request Jul 21, 2022
This adds a missing test for #3963
hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 27, 2023
gateway: don't redirect to trailing slash if it's go get

This commit was moved from ipfs/kubo@67828a4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gateway Topic gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant