Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: avoid raw path redirect loops#4659

Open
puneetdixit200 wants to merge 1 commit into
gin-gonic:masterfrom
puneetdixit200:fix/4034-redirect-fixed-path
Open

fix: avoid raw path redirect loops#4659
puneetdixit200 wants to merge 1 commit into
gin-gonic:masterfrom
puneetdixit200:fix/4034-redirect-fixed-path

Conversation

@puneetdixit200
Copy link
Copy Markdown

Fixes #4034

This clears URL.RawPath after RedirectFixedPath rewrites URL.Path. Without that, URL.String() can keep emitting the original lowercase escaped raw path, so clients get redirected back to the same URL when UseRawPath is enabled.

The new regression covers the lowercase percent-encoded /あ case and verifies the canonical uppercase escaped path is served without another redirect.

Checklist:

  • Opened against master
  • Added a test for the behavior change
  • Tests pass locally

Tests:

  • go test -run TestRouteRedirectFixedPath
  • make test
  • go test ./...
  • go vet ./...
  • .bin/golangci-lint run --verbose

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.37%. Comparing base (3dc1cd6) to head (9395c62).
⚠️ Report is 276 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4659      +/-   ##
==========================================
- Coverage   99.21%   98.37%   -0.84%     
==========================================
  Files          42       48       +6     
  Lines        3182     3139      -43     
==========================================
- Hits         3157     3088      -69     
- Misses         17       42      +25     
- Partials        8        9       +1     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.36% <100.00%> (?)
-tags go_json 98.29% <100.00%> (?)
-tags nomsgpack 98.35% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.25 98.37% <100.00%> (?)
go-1.26 98.37% <100.00%> (?)
macos-latest 98.37% <100.00%> (-0.84%) ⬇️
ubuntu-latest 98.37% <100.00%> (-0.84%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@puneetdixit200 puneetdixit200 force-pushed the fix/4034-redirect-fixed-path branch from d2940af to 9477237 Compare May 23, 2026 09:48
@puneetdixit200 puneetdixit200 force-pushed the fix/4034-redirect-fixed-path branch from 9477237 to 9395c62 Compare May 25, 2026 14:31
@puneetdixit200
Copy link
Copy Markdown
Author

I refreshed the branch against current master by force-pushing the same tree at 9395c62 so CI/Codecov would rerun. All GitHub Actions checks pass on the refreshed head, and Codecov patch coverage still passes with all modified coverable lines covered.

The remaining codecov/project failure still appears to be a stale Codecov base issue: the report compares against base 3dc1cd6 and says it is 276 commits behind master, even though the PR base is current 5f4f964.

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.

[Bug] infinite redirect with RedirectFixedPath

1 participant