From 55d86696b6e1d6d26d9ce40f5ef93bb836de3017 Mon Sep 17 00:00:00 2001 From: Mateus Souza Date: Fri, 12 Aug 2022 14:40:41 -0300 Subject: [PATCH] Fixed path normalization considering all possible cases --- src/extra/route.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/extra/route.ts b/src/extra/route.ts index 4168f2c..fea1472 100644 --- a/src/extra/route.ts +++ b/src/extra/route.ts @@ -66,8 +66,9 @@ const _options = { */ function normalizePath(path: string, removeQuery?: boolean) { + path = path.replace(window.location.protocol + '//', '') + path = path.replace(window.location.host, '') path = path.replace(_options.base, '') - path = path.replace(window.location.origin, '') path = path.replace('/?', '?') path = path.replace(new RegExp('[/]*$'), '') path = path.replace(new RegExp('^[/]*'), '')