Skip to content

fix/gateway: escape directory redirect url#779

Merged
gammazero merged 5 commits intomainfrom
fix-gateway/percent-in-dirname
Jan 3, 2025
Merged

fix/gateway: escape directory redirect url#779
gammazero merged 5 commits intomainfrom
fix-gateway/percent-in-dirname

Conversation

@gammazero
Copy link
Contributor

@gammazero gammazero commented Jan 2, 2025

When a directory gets redirected to a URL with a treailing slash, special chars in the directory name must be escaped in the redirect URL.

Depends on ipfs/gateway-conformance#225
Required by: ipfs/kubo#10649

Fixes issue ipfs/kubo#10536

TODO:

  • Merge gateway-conformance PR and bump version
  • Update to latest gateway-conformance version in .github/workflows/gateway-sharness.yml
  • Remove ref from .github/workflows/gateway-sharness.yml after merge of this PR and merge of kubo PR

@gammazero gammazero requested review from a team and lidel as code owners January 2, 2025 09:53
@gammazero gammazero changed the title Fix web links for directories with "%" in name fix/gateway: web links for directories with "%" in name Jan 2, 2025
@codecov
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.49%. Comparing base (85fbc3a) to head (00b4386).
Report is 1 commits behind head on main.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #779      +/-   ##
==========================================
- Coverage   60.51%   60.49%   -0.02%     
==========================================
  Files         245      245              
  Lines       31126    31126              
==========================================
- Hits        18835    18831       -4     
- Misses      10622    10623       +1     
- Partials     1669     1672       +3     
Files with missing lines Coverage Δ
gateway/handler_unixfs_dir.go 65.88% <100.00%> (-2.36%) ⬇️

... and 9 files with indirect coverage changes

Directories with a "%" in their name do not work correctly when when redirected to a URL with a trailing slash. When the original URl contains special characters, such as "%", the correcponding redirect URL must escape these characters.

Fixes issue ipfs/kubo#10536
@gammazero gammazero force-pushed the fix-gateway/percent-in-dirname branch from f71abb0 to 16d89a5 Compare January 2, 2025 12:08
@gammazero gammazero changed the title fix/gateway: web links for directories with "%" in name fix/gateway: escape directory redirect url Jan 2, 2025
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.

2 participants