mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-25 02:36:20 +01:00
Allow slashes in tracker names.
This commit is contained in:
parent
dbc19e4ffd
commit
d2c9c45461
@ -24,7 +24,7 @@ function customScriptName(req) {
|
|||||||
if (scriptName) {
|
if (scriptName) {
|
||||||
const url = req.nextUrl.clone();
|
const url = req.nextUrl.clone();
|
||||||
const { pathname } = url;
|
const { pathname } = url;
|
||||||
const names = scriptName.split(',').map(name => name.trim());
|
const names = scriptName.split(',').map(name => name.trim().replace(/^\/+/, ''));
|
||||||
|
|
||||||
if (names.find(name => pathname.endsWith(name))) {
|
if (names.find(name => pathname.endsWith(name))) {
|
||||||
url.pathname = '/script.js';
|
url.pathname = '/script.js';
|
||||||
|
@ -49,10 +49,8 @@ if (process.env.TRACKER_SCRIPT_NAME) {
|
|||||||
|
|
||||||
if (names) {
|
if (names) {
|
||||||
names.forEach(name => {
|
names.forEach(name => {
|
||||||
const slash = name.substring(0, 1) === '/' ? '' : '/';
|
|
||||||
|
|
||||||
rewrites.push({
|
rewrites.push({
|
||||||
source: `${slash}${name}`,
|
source: `/${name.replace(/^\/+/, '')}`,
|
||||||
destination: '/script.js',
|
destination: '/script.js',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user