Skip to content

Fix PE redirect percent encoding#603

Closed
kentcdodds wants to merge 1 commit intomainfrom
cursor/fix-pe-redirect-encoding-d520
Closed

Fix PE redirect percent encoding#603
kentcdodds wants to merge 1 commit intomainfrom
cursor/fix-pe-redirect-encoding-d520

Conversation

@kentcdodds
Copy link
Copy Markdown
Member

@kentcdodds kentcdodds commented May 1, 2026

Summary

  • Route progressive enhancement redirects through toRedirectLocation so already-percent-encoded paths are not double encoded.
  • Add regression coverage for encoded paths, non-ASCII paths, unsafe redirects, and unencodable input.

Testing

  • npx nx run @epic-web/workshop-app:build passes.
  • npm --prefix packages/workshop-app run lint passes.
  • npx tsx --conditions development -e "import { toRedirectLocation } from './packages/workshop-app/app/utils/pe.tsx'; const cases = [['/foo%20bar','/foo%20bar'], ['/café','/caf%C3%A9'], ['https://example.com/foo%20bar','/'], ['/'+String.fromCharCode(0xd800), '/']]; for (const [input, expected] of cases) { const actual = toRedirectLocation(input); if (actual !== expected) throw new Error(input + ' expected ' + expected + ' got ' + actual); console.log(input.replace(/\\ud800/g, '<surrogate>') + ' => ' + actual); }" passes.
  • npm test passed in the git pre-push hook: 21 files, 167 tests.
Open in Web Open in Cursor 

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 1, 2026

View your CI Pipeline Execution ↗ for commit dc21bc5

Command Status Duration Result
nx run-many --target typecheck ✅ Succeeded 10s View ↗
nx run-many --target build ✅ Succeeded 40s View ↗
nx lint ✅ Succeeded 25s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-01 15:30:18 UTC

@kentcdodds kentcdodds closed this May 1, 2026
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