mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Prevent blank urls.
This commit is contained in:
parent
14a8ae2b81
commit
a026fc97fc
1 changed files with 5 additions and 1 deletions
|
|
@ -96,6 +96,10 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||
let [referrerPath, referrerQuery] = referrer?.split('?') || [];
|
||||
let referrerDomain;
|
||||
|
||||
if (!urlPath) {
|
||||
urlPath = '/';
|
||||
}
|
||||
|
||||
if (referrerPath.startsWith('http')) {
|
||||
const refUrl = new URL(referrer);
|
||||
referrerPath = refUrl.pathname;
|
||||
|
|
@ -104,7 +108,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||
}
|
||||
|
||||
if (process.env.REMOVE_TRAILING_SLASH) {
|
||||
urlPath = urlPath.replace(/\/$/, '');
|
||||
urlPath = urlPath.replace(/.+\/$/, '');
|
||||
}
|
||||
|
||||
await saveEvent({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue