Fixed regex for filter params.
Some checks are pending
Create docker images (cloud) / Build, push, and deploy (push) Waiting to run
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run

This commit is contained in:
Mike Cao 2025-10-10 11:33:13 -07:00
parent ac9edb8b5f
commit 53929626cf

View file

@ -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 };
}