Skip to content

Commit

Permalink
fix(coercePath): remove the "g" modifier from port/protocol regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Dec 14, 2021
1 parent a7fe2a9 commit 4563b6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/matching/matchRequestUrl.ts
Expand Up @@ -40,13 +40,13 @@ export function coercePath(path: string): string {
* Escape the port so that "path-to-regexp" can match
* absolute URLs including port numbers.
*/
.replace(/([^\/])(:)(?=\d+)/g, '$1\\$2')
.replace(/([^\/])(:)(?=\d+)/, '$1\\$2')
/**
* Escape the protocol so that "path-to-regexp" could match
* absolute URL.
* @see https://github.com/pillarjs/path-to-regexp/issues/259
*/
.replace(/^([^\/]+)(:)(?=\/\/)/g, '$1\\$2')
.replace(/^([^\/]+)(:)(?=\/\/)/, '$1\\$2')
)
}

Expand Down

0 comments on commit 4563b6c

Please sign in to comment.