Skip to content

Commit

Permalink
Merge pull request ipfs/kubo#7727 from ipfs/fix/preserver-query-on-we…
Browse files Browse the repository at this point in the history
…bsite-redirect

fix(gw): preserve query on website redirect

This commit was moved from ipfs/kubo@0700c74
  • Loading branch information
aschmahmann authored Nov 10, 2020
2 parents 529cdf2 + ce0319c commit c258442
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gateway/core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,12 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
goget := r.URL.Query().Get("go-get") == "1"
if dirwithoutslash && !goget {
// See comment above where originalUrlPath is declared.
http.Redirect(w, r, originalUrlPath+"/", 302)
suffix := "/"
if r.URL.RawQuery != "" {
// preserve query parameters
suffix = suffix + "?" + r.URL.RawQuery
}
http.Redirect(w, r, originalUrlPath+suffix, 302)
return
}

Expand Down

0 comments on commit c258442

Please sign in to comment.