Skip to content

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

Merged
whyrusleeping merged 1 commit intomasterfrom
feat/gateway-go-get
Jun 9, 2017
Merged

gateway: don't redirect to trailing slash if it's go get#3963
whyrusleeping merged 1 commit intomasterfrom
feat/gateway-go-get

Conversation

@ghost
Copy link
Copy Markdown

@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 <larsg@systemli.org>
@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
Copy Markdown
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