diff --git a/CHANGELOG.md b/CHANGELOG.md index 199b69066..e98e6dd57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ The following emojis are used to highlight certain changes: ### Fixed +- `gateway` Fix links for subdirectories with "%" in name. [#779](https://github.com/ipfs/boxo/pull/779) + ### Security diff --git a/gateway/handler_unixfs_dir.go b/gateway/handler_unixfs_dir.go index 6f9f856d1..0aa54b50b 100644 --- a/gateway/handler_unixfs_dir.go +++ b/gateway/handler_unixfs_dir.go @@ -50,7 +50,7 @@ func (i *handler) serveDirectory(ctx context.Context, w http.ResponseWriter, r * suffix = suffix + "?" + r.URL.RawQuery } // /ipfs/cid/foo?bar must be redirected to /ipfs/cid/foo/?bar - redirectURL := originalURLPath + suffix + redirectURL := requestURI.EscapedPath() + suffix rq.logger.Debugw("directory location moved permanently", "status", http.StatusMovedPermanently) http.Redirect(w, r, redirectURL, http.StatusMovedPermanently) return true