fix(path): handle malformed encoded pathnames without throwing#1362
fix(path): handle malformed encoded pathnames without throwing#1362
Conversation
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/unit/path.test.ts`:
- Around line 4-22: Replace the top-level describe with the cross-runtime test
harness by using describeMatrix instead of describe (e.g. change describe("path
utilities", () => { ... }) to describeMatrix("path utilities", () => { ... })),
ensure describeMatrix is imported from your test matrix helper where other
matrix tests import it, and keep the existing inner suite and assertions
(including decodePathname) unchanged so the same tests run under both web and
node runtimes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 10fefb88-0af5-4b71-ad90-eb4977689c3c
📒 Files selected for processing (2)
src/utils/internal/path.tstest/unit/path.test.ts
| try { | ||
| return decodeURI(pathname.includes("%25") ? pathname.replace(/%25/g, "%2525") : pathname); | ||
| } catch { | ||
| return pathname; |
There was a problem hiding this comment.
Wouldn't this impose a security risk surface with incosistent path handling? I suggest making silent fallback behavior opt-in with a h3 global config like strictPaths: false and pass to decode util if really necessary.
…s-without-throwing
resolves #1361
Summary by CodeRabbit
Bug Fixes
Tests