Skip to content

Commit

Permalink
Fixed path normalization considering all possible cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mateussouzaweb committed Aug 12, 2022
1 parent ab3bfaa commit 55d8669
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/extra/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('^[/]*'), '')
Expand Down

0 comments on commit 55d8669

Please sign in to comment.