Fix ContentType validation to handle non-string/non-array field values safely

Co-authored-by: estruyf <2900833+estruyf@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-06-20 12:48:08 +00:00
parent f1ae60f280
commit a387d5eb89

View File

@@ -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);