From a387d5eb891d9627d8a6e4374ff554c420e0602e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Jun 2025 12:48:08 +0000 Subject: [PATCH] Fix ContentType validation to handle non-string/non-array field values safely Co-authored-by: estruyf <2900833+estruyf@users.noreply.github.com> --- src/helpers/ContentType.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helpers/ContentType.ts b/src/helpers/ContentType.ts index 14438c26..2eec9fe1 100644 --- a/src/helpers/ContentType.ts +++ b/src/helpers/ContentType.ts @@ -408,7 +408,7 @@ export class ContentType { * @param parents * @returns */ - public static getFieldValue(data: any, parents: string[]): string | string[] { + public static getFieldValue(data: any, parents: string[]): any { let fieldValue = []; let crntPageData = data; @@ -575,7 +575,8 @@ export class ContentType { fieldValue === null || fieldValue === undefined || fieldValue === '' || - fieldValue.length === 0 || + (Array.isArray(fieldValue) && fieldValue.length === 0) || + (typeof fieldValue === 'string' && fieldValue.length === 0) || fieldValue === DefaultFieldValues.faultyCustomPlaceholder ) { emptyFields.push(fields);