fix(utils): handle raw hashes and queries in url relative() + add tests#770
fix(utils): handle raw hashes and queries in url relative() + add tests#770ryzrr wants to merge 1 commit intonodejs:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview Adds a new Reviewed by Cursor Bugbot for commit 5f013f9. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #770 +/- ##
==========================================
+ Coverage 78.43% 78.56% +0.13%
==========================================
Files 157 158 +1
Lines 13962 14015 +53
Branches 1152 1163 +11
==========================================
+ Hits 10951 11011 +60
+ Misses 3006 3000 -6
+ Partials 5 4 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR adds the missing unit tests for the relative utility in
src/utils/url.mjsand patches a minor logic flaw in how it handles hashes and query strings. I included a quick short-circuit to ensure that raw fragments (like#fragment) stay completely intact instead of being mistakenly processed as directory paths.Note: This is not actively breaking the site right now because no component
currently passes a raw hash to the resolver. However, it is a dormant footgun
that could easily cause unexpected bugs if routing or navigation changes in the future.*
Validation
I ran the Node test suite locally to verify the new url.test.mjs file. The tests confirm that all URL resolution edge cases are handled perfectly and that the existing logic remains completely untouched.
Related Issues
No Related Issues.
Check List
node --run testand all tests passed.node --run format&node --run lint.