mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Fixed regex for filter params.
This commit is contained in:
parent
ac9edb8b5f
commit
53929626cf
1 changed files with 6 additions and 1 deletions
|
|
@ -3,10 +3,15 @@ import { Filter, QueryFilters, QueryOptions } from '@/lib/types';
|
|||
|
||||
export function parseFilterValue(param: any) {
|
||||
if (typeof param === 'string') {
|
||||
const [, operator, value] = param.match(/^([a-z]+)\.(.*)/) || [];
|
||||
const operatorValues = Object.values(OPERATORS).join('|');
|
||||
|
||||
const regex = new RegExp(`^(${operatorValues})\\.(.*)$`);
|
||||
|
||||
const [, operator, value] = param.match(regex) || [];
|
||||
|
||||
return { operator: operator || OPERATORS.equals, value: value || param };
|
||||
}
|
||||
|
||||
return { operator: OPERATORS.equals, value: param };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue