Skip to content

Commit

Permalink
🐛 Fix iphone 13 unable to use regex lookbehinds (#3823)
Browse files Browse the repository at this point in the history
* fix iphone 13 unable to use regex lookbehinds

* release notes
  • Loading branch information
MikesGlitch authored Nov 12, 2024
1 parent 2cb668a commit dd69e53
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/loot-core/src/server/accounts/transaction-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,19 @@ export function conditionsToAQL(conditions, { recurDateBounds = 100 } = {}) {
return { $or: values.map(v => apply(field, '$eq', v)) };

case 'hasTags':
const tagValues = value
.split(/(?<!#)(#[\w\d\p{Emoji}-]+)(?=\s|$)/gu)
.filter(tag => tag.startsWith('#'));
const words = value.split(/\s+/);
const tagValues = [];
words.forEach(word => {
const startsWithHash = word.startsWith('#');
const containsMultipleHash = word.slice(1).includes('#');
const correctlyFormatted = word.match(/#[\w\d\p{Emoji}-]+/gu);
const validHashtag =
startsWithHash && !containsMultipleHash && correctlyFormatted;

if (validHashtag) {
tagValues.push(word);
}
});

return {
$and: tagValues.map(v => {
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3823.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MikesGlitch]
---

Fix Iphone 13 error when attempting to view budget.

0 comments on commit dd69e53

Please sign in to comment.