Fix destructive update behavior in n8n cookie operations
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é <emile@getprobo.com>
This commit is contained in:
@@ -159,9 +159,7 @@ export async function execute(
|
||||
|
||||
const input: Record<string, unknown> = { 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;
|
||||
|
||||
Reference in New Issue
Block a user