From 1650b26fa9abcf8fb93b673745614000d6aa939d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Fri, 1 May 2026 20:11:37 +0400 Subject: [PATCH] Fix destructive update behavior in n8n cookie operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid clearing existing values when optional fields are left at their defaults: only send privacyPolicyUrl/maxAgeSeconds when truthy, filter empty entries from gcmConsentTypes, and constrain consentExpiryDays to positive integers on create. Signed-off-by: Émile Ré --- .../nodes/Probo/actions/cookieBanner/create.operation.ts | 3 +++ .../nodes/Probo/actions/cookieBanner/update.operation.ts | 4 +--- .../nodes/Probo/actions/cookieCategory/update.operation.ts | 5 ++++- .../nodes/Probo/actions/cookiePattern/update.operation.ts | 6 ++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/n8n-node/nodes/Probo/actions/cookieBanner/create.operation.ts b/packages/n8n-node/nodes/Probo/actions/cookieBanner/create.operation.ts index 3b077d9b1..de7e00da1 100644 --- a/packages/n8n-node/nodes/Probo/actions/cookieBanner/create.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/cookieBanner/create.operation.ts @@ -82,6 +82,9 @@ export const description: INodeProperties[] = [ operation: ['create'], }, }, + typeOptions: { + minValue: 1, + }, default: 365, description: 'Number of days before consent expires', required: true, diff --git a/packages/n8n-node/nodes/Probo/actions/cookieBanner/update.operation.ts b/packages/n8n-node/nodes/Probo/actions/cookieBanner/update.operation.ts index 005f65b8e..ba2c1daa5 100644 --- a/packages/n8n-node/nodes/Probo/actions/cookieBanner/update.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/cookieBanner/update.operation.ts @@ -159,9 +159,7 @@ export async function execute( const input: Record = { cookieBannerId }; if (name) input.name = name; - if (privacyPolicyUrl !== undefined) { - input.privacyPolicyUrl = privacyPolicyUrl === '' ? null : privacyPolicyUrl; - } + if (privacyPolicyUrl) input.privacyPolicyUrl = privacyPolicyUrl; if (cookiePolicyUrl) input.cookiePolicyUrl = cookiePolicyUrl; if (consentExpiryDays) input.consentExpiryDays = consentExpiryDays; if (consentMode) input.consentMode = consentMode; diff --git a/packages/n8n-node/nodes/Probo/actions/cookieCategory/update.operation.ts b/packages/n8n-node/nodes/Probo/actions/cookieCategory/update.operation.ts index e8d90e381..46d61d738 100644 --- a/packages/n8n-node/nodes/Probo/actions/cookieCategory/update.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/cookieCategory/update.operation.ts @@ -150,7 +150,10 @@ export async function execute( if (slug) input.slug = slug; if (categoryDescription) input.description = categoryDescription; if (gcmConsentTypes) { - input.gcmConsentTypes = gcmConsentTypes.split(',').map((s) => s.trim()); + input.gcmConsentTypes = gcmConsentTypes + .split(',') + .map((s) => s.trim()) + .filter((s) => s.length > 0); } if (posthogConsent) input.posthogConsent = posthogConsent === 'true'; diff --git a/packages/n8n-node/nodes/Probo/actions/cookiePattern/update.operation.ts b/packages/n8n-node/nodes/Probo/actions/cookiePattern/update.operation.ts index cb5928040..1a16ae458 100644 --- a/packages/n8n-node/nodes/Probo/actions/cookiePattern/update.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/cookiePattern/update.operation.ts @@ -54,7 +54,7 @@ export const description: INodeProperties[] = [ }, }, default: 0, - description: 'The maximum age of the cookie in seconds (0 to clear)', + description: 'The maximum age of the cookie in seconds (leave at 0 to keep unchanged)', }, { displayName: 'Excluded', @@ -133,9 +133,7 @@ export async function execute( const input: Record = { cookiePatternId }; if (displayName) input.displayName = displayName; - if (maxAgeSeconds !== undefined) { - input.maxAgeSeconds = maxAgeSeconds === 0 ? null : maxAgeSeconds; - } + if (maxAgeSeconds > 0) input.maxAgeSeconds = maxAgeSeconds; if (excluded) input.excluded = excluded === 'true'; if (patternDescription) input.description = patternDescription;