Skip to content

Commit

Permalink
fix(path-match): avoid parsing path as regex (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjhsf authored Oct 29, 2024
1 parent e8f96e7 commit 352342f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/pathMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ export function pathMatch(reqPath: string, cookiePath: string): boolean {
// " o The cookie-path is a prefix of the request-path, and the first
// character of the request-path that is not included in the cookie- path
// is a %x2F ("/") character."
if (
new RegExp(`^${cookiePath}`).test(reqPath) &&
reqPath[cookiePath.length] === '/'
) {
if (reqPath.startsWith(cookiePath) && reqPath[cookiePath.length] === '/') {
return true
}
}
Expand Down

0 comments on commit 352342f

Please sign in to comment.