mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
fix #3083 improve the parseURL function to handle page-relative URLs like pushState
This commit is contained in:
parent
d76603b5b7
commit
c85f82819e
@ -54,7 +54,7 @@
|
|||||||
const parseURL = url => {
|
const parseURL = url => {
|
||||||
try {
|
try {
|
||||||
// use location.origin as the base to handle cases where the url is a relative path
|
// use location.origin as the base to handle cases where the url is a relative path
|
||||||
const { pathname, search, hash } = new URL(url, origin);
|
const { pathname, search, hash } = new URL(url, href);
|
||||||
url = pathname + search + hash;
|
url = pathname + search + hash;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* empty */
|
/* empty */
|
||||||
@ -79,6 +79,7 @@
|
|||||||
if (!url) return;
|
if (!url) return;
|
||||||
|
|
||||||
currentRef = currentUrl;
|
currentRef = currentUrl;
|
||||||
|
|
||||||
currentUrl = parseURL(url.toString());
|
currentUrl = parseURL(url.toString());
|
||||||
|
|
||||||
if (currentUrl !== currentRef) {
|
if (currentUrl !== currentRef) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user