mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
Prevent blank urls.
This commit is contained in:
parent
14a8ae2b81
commit
a026fc97fc
@ -96,6 +96,10 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||||||
let [referrerPath, referrerQuery] = referrer?.split('?') || [];
|
let [referrerPath, referrerQuery] = referrer?.split('?') || [];
|
||||||
let referrerDomain;
|
let referrerDomain;
|
||||||
|
|
||||||
|
if (!urlPath) {
|
||||||
|
urlPath = '/';
|
||||||
|
}
|
||||||
|
|
||||||
if (referrerPath.startsWith('http')) {
|
if (referrerPath.startsWith('http')) {
|
||||||
const refUrl = new URL(referrer);
|
const refUrl = new URL(referrer);
|
||||||
referrerPath = refUrl.pathname;
|
referrerPath = refUrl.pathname;
|
||||||
@ -104,7 +108,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.REMOVE_TRAILING_SLASH) {
|
if (process.env.REMOVE_TRAILING_SLASH) {
|
||||||
urlPath = urlPath.replace(/\/$/, '');
|
urlPath = urlPath.replace(/.+\/$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveEvent({
|
await saveEvent({
|
||||||
|
Loading…
Reference in New Issue
Block a user