From 8ce85e37592da061164db18af52852e8ed1d2046 Mon Sep 17 00:00:00 2001 From: Marcus <56945030+maspio@users.noreply.github.com> Date: Fri, 27 Jan 2023 08:30:49 +0100 Subject: [PATCH] fix(Notion (Beta) Node): Fix create database page with multiple relation ids not working (#5260) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix --- .../nodes-base/nodes/Notion/GenericFunctions.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/nodes-base/nodes/Notion/GenericFunctions.ts b/packages/nodes-base/nodes/Notion/GenericFunctions.ts index f338c33cfd1cf..7f41196780443 100644 --- a/packages/nodes-base/nodes/Notion/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Notion/GenericFunctions.ts @@ -27,7 +27,6 @@ import moment from 'moment-timezone'; import { validate as uuidValidate } from 'uuid'; function uuidValidateWithoutDashes(this: IExecuteFunctions, value: string) { - if (!value || typeof value !== 'string') return false; if (uuidValidate(value)) return true; if (value.length == 32) { //prettier-ignore @@ -313,12 +312,16 @@ function getPropertyKeyValue( result = { type: 'relation', relation: value.relationValue - .filter((rv: string) => { - return uuidValidateWithoutDashes.call(this, rv); + .filter((relation: any) => { + return relation && typeof relation === 'string'; }) .reduce((acc: [], cur: any) => { - return acc.concat(cur.split(',').map((relation: string) => ({ id: relation.trim() }))); - }, []), + return acc.concat(cur.split(',').map((relation: string) => relation.trim())); + }, []) + .filter((relation: string) => { + return uuidValidateWithoutDashes.call(this, relation); + }) + .map((relation: string) => ({ id: relation })), }; break; case 'multi_select':