-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(withoutTrailingSlash): consider qurry param #219
Conversation
src/utils.ts
Outdated
@@ -84,15 +84,15 @@ export function hasTrailingSlash( | |||
respectQueryAndFragment?: boolean | |||
): boolean { | |||
if (!respectQueryAndFragment) { | |||
return input.endsWith("/"); | |||
return !input.includes("?") && input.endsWith("/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(notice that by default, we do not handle query
. we probably don't want to change logic in this line)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see that query is not handled by default, but what to do with these cases?
because, currently, all these calls return true
:
hasTrailingSlash('/a?b=/', false)
hasTrailingSlash('/a/?b=/', false)
hasTrailingSlash('/a?b=/', true)
hasTrailingSlash('/a/?b=/', true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking, without this change, only failing test is withoutTrailingSlash('foo/?k=/', false /* no respect */)
. (test in L88 still passes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have revert it for now since change on hasProcol
like this is risky to introduce behavior changes.
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #219 +/- ##
==========================================
+ Coverage 95.27% 98.69% +3.42%
==========================================
Files 7 7
Lines 867 1378 +511
Branches 187 230 +43
==========================================
+ Hits 826 1360 +534
+ Misses 41 18 -23 β View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
π Linked issue
Fixes #214
β Type of change
π Checklist