Repository navigation
fix(unplugin): keep hex character codes in param segments regexp - #2811
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: vuejs/router/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe parser now adds decoded character codes to ChangesPath segment parsing
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Hex-encoded suffixes are retained in route matching, and source inspection confirms the parameter capture remains intact. No actionable merge risk was found. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
commit: |

Root cause
In
parseFileSegment(), a[x+HH]character code is appended topathSegmentbut never pushed tosubSegments. For static segments this does not matter, but param segments build their regexp (TreeNodeValueParam.re) and the experimental resolver path parts (matcherPatternPathDynamicParts) fromsubSegments, so the decoded character is silently dropped there.For example
[id][x+2E]json.vuegets the correct path:id.json, but its regexp is/^\/([^/]+?)json$/iand its path parts are[[1, 'json']]. With the experimental resolver,/foo.jsonresolves withidset tofoo.,/foojsonalso matches, and building the route with{ id: 'foo' }gives/foojson.Fix
Push the decoded character to
subSegmentsas a static part, next to the existingpathSegmentupdate.Test
Added a case to the
path regexptests intree.spec.tsfor[id][x+2E]json. It fails before the fix (expected '/^\/([^/]+?)json$/i' to be '/^\/([^/]+?)\.json$/i') and passes after. The rest of the unplugin tests still pass.Summary by CodeRabbit
.jsonare recognized correctly while the parameter remains captured as expected.