Skip to content

A local-first personal finance app

fix TypeError in GoCardless bnp-be-gebabebb sync (#370)

vojeroen44ddf210ea28
diff --git a/src/app-gocardless/banks/bnp-be-gebabebb.js b/src/app-gocardless/banks/bnp-be-gebabebb.js
index 6cc688fec8..72e11a24d0 100644
--- a/src/app-gocardless/banks/bnp-be-gebabebb.js
+++ b/src/app-gocardless/banks/bnp-be-gebabebb.js
@@ -39,10 +39,10 @@ export default {
let value = (match[4] || match[5]).trim();
if (key === 'narrative') {
// Set narrativeName to the first element in the "narrative" array.
- creditorNameFromNarrative = value
- .matchAll(/'([a-zA-Z0-9\s]*)'/g)
- ?.next()
- .value[1].trim();
+ let first_value = value.matchAll(/'(.+?)'/g)?.next().value;
+ creditorNameFromNarrative = first_value
+ ? first_value[1].trim()
+ : undefined;
}
// Remove square brackets and single quotes and commas
value = value.replace(/[[\]',]/g, '');
diff --git a/upcoming-release-notes/370.md b/upcoming-release-notes/370.md
new file mode 100644
index 0000000000..81222b01a2
--- /dev/null
+++ b/upcoming-release-notes/370.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [vojeroen]
+---
+
+Fix failing GoCardless syncs with a bnp-be-gebabebb account.