From c48da6d245a12405c729ff46a52b1a996b6e564f Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Fri, 25 Aug 2023 17:44:24 +0200 Subject: [PATCH] cli tool: handle accents in filter --- tools/nodeclient/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/nodeclient/app.js b/tools/nodeclient/app.js index 5058d0c..aaeec02 100644 --- a/tools/nodeclient/app.js +++ b/tools/nodeclient/app.js @@ -15,6 +15,11 @@ var filter = process.argv.length > 2 ? process.argv[2] : ""; var intervalid = null; var notes = null; +function simplifystring(str) +{ + return str.toLowerCase().normalize('NFD').replace(/\p{Diacritic}/gu, ""); +} + async function decrypt(str) { var key = pgpkey.split("-----END PGP PUBLIC KEY BLOCK-----")[1]; @@ -41,7 +46,7 @@ async function encrypt(str) function filteredlist() { return notes - .filter(n => n.title.toLowerCase().includes(filter.toLowerCase())); + .filter(n => simplifystring(n.title).includes(simplifystring(filter))); } axios.post(`${settings.url}/handler.php`,