:electron: Fix regex filters on electron app (#2929)

* fix regex on desktop app

* add release notes
This commit is contained in:
Michael Clark
2024-06-24 16:08:15 +01:00
committed by GitHub
parent 6a21f8e3de
commit 46ea8fbf72
2 changed files with 12 additions and 0 deletions

View File

@@ -95,6 +95,10 @@ export async function asyncTransaction(
}
}
function regexp(regex: string, text: string | null) {
return new RegExp(regex).test(text) ? 1 : 0;
}
export function openDatabase(pathOrBuffer: string | Buffer) {
const db = new SQL(pathOrBuffer);
// Define Unicode-aware LOWER and UPPER implementation.
@@ -107,6 +111,8 @@ export function openDatabase(pathOrBuffer: string | Buffer) {
db.function('UNICODE_UPPER', { deterministic: true }, (arg: string | null) =>
arg?.toUpperCase(),
);
// @ts-expect-error @types/better-sqlite3 does not support setting strict 3rd argument
db.function('REGEXP', { deterministic: true }, regexp);
return db;
}

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MikesGlitch]
---
Fixes regex filtering on the desktop app