fix: referrer with query strings wont be parsed

pull/1095/head
Holger Huo 2022-04-12 17:14:45 +08:00
parent d381560027
commit be0c43dcaa
1 changed files with 4 additions and 3 deletions

View File

@ -64,9 +64,10 @@ export function getFilterQuery(table, filters = {}, params = []) {
switch (key) { switch (key) {
case 'url': case 'url':
if (table === 'session' || table === 'pageview') { if (table === 'session' || table === 'pageview' || table === 'event') {
arr.push(`and ${table}.${key}=$${params.length + 1}`); arr.push(`and (${table}.${key}=$${params.length + 1} or ${table}.${key} like $${params.length + 2})`);
params.push(decodeURIComponent(value)); params.push(decodeURIComponent(value));
params.push(`${decodeURIComponent(value)}?%`);
} }
break; break;
@ -125,7 +126,7 @@ export function parseFilters(table, filters = {}, params = []) {
os || browser || device || country os || browser || device || country
? `inner join session on ${table}.session_id = session.session_id` ? `inner join session on ${table}.session_id = session.session_id`
: '', : '',
pageviewQuery: getFilterQuery('pageview', pageviewFilters, params), pageviewQuery: table === 'event' ? getFilterQuery('event', pageviewFilters, params) : getFilterQuery('pageview', pageviewFilters, params),
sessionQuery: getFilterQuery('session', sessionFilters, params), sessionQuery: getFilterQuery('session', sessionFilters, params),
eventQuery: getFilterQuery('event', eventFilters, params), eventQuery: getFilterQuery('event', eventFilters, params),
}; };