fix Tag filtering crashing app when tag has regex special character (#3725)

* fix Tag filtering crashing app when tag has regex special character

* release-notes

---------

Co-authored-by: Joel Rich <joelrich@protonmail.com>
This commit is contained in:
joel-rich
2024-10-27 02:10:52 -06:00
committed by GitHub
parent a6da06a8ef
commit f265dd9df0
2 changed files with 9 additions and 1 deletions

View File

@@ -468,7 +468,9 @@ export function conditionsToAQL(conditions, { recurDateBounds = 100 } = {}) {
return {
$and: tagValues.map(v => {
const regex = new RegExp(`(^|\\s)${v}(\\s|$)`);
const regex = new RegExp(
`(^|\\s)${v.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(\\s|$)`,
);
return apply(field, '$regexp', regex.source);
}),
};

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [joel-rich]
---
fix Tag filtering crashing app when tag has regex special character