From 4563b6c40f5a603c8a4bbc347e763607c9e9a903 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Wed, 15 Dec 2021 00:30:32 +0100 Subject: [PATCH] fix(coercePath): remove the "g" modifier from port/protocol regexp --- src/utils/matching/matchRequestUrl.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/matching/matchRequestUrl.ts b/src/utils/matching/matchRequestUrl.ts index cd590a00b..8f9c29ae0 100644 --- a/src/utils/matching/matchRequestUrl.ts +++ b/src/utils/matching/matchRequestUrl.ts @@ -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') ) }