From 44ddf210ea2853672ea94c8faa68cc36c3312889 Mon Sep 17 00:00:00 2001 From: vojeroen <21264520+vojeroen@users.noreply.github.com> Date: Sun, 16 Jun 2024 15:45:03 +0200 Subject: [PATCH] fix TypeError in GoCardless bnp-be-gebabebb sync (#370) --- src/app-gocardless/banks/bnp-be-gebabebb.js | 8 ++++---- upcoming-release-notes/370.md | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 upcoming-release-notes/370.md diff --git a/src/app-gocardless/banks/bnp-be-gebabebb.js b/src/app-gocardless/banks/bnp-be-gebabebb.js index 6cc688fec..72e11a24d 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 000000000..81222b01a --- /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.