Skip to content

Commit

Permalink
fix Tag filtering crashing app when tag has regex special character (a…
Browse files Browse the repository at this point in the history
…ctualbudget#3725)

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

* release-notes

---------

Co-authored-by: Joel Rich <[email protected]>
  • Loading branch information
joel-rich and Joel Rich authored Oct 27, 2024
1 parent a6da06a commit f265dd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/loot-core/src/server/accounts/transaction-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}),
};
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3725.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [joel-rich]
---

fix Tag filtering crashing app when tag has regex special character

0 comments on commit f265dd9

Please sign in to comment.