fix(workflow): add empty array validation for required checklist fields in trigger plugin
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions

The checkValid function was not properly validating required checklist fields when they had empty array values. This caused required fields to pass validation even when no options were selected.

Added array length check to the constant type validation to ensure required checklist fields must have at least one selected option.
This commit is contained in:
lyzno1 2025-10-29 12:36:43 +08:00
parent 0b599b44b0
commit 852d851996
No known key found for this signature in database

View File

@ -272,7 +272,12 @@ const nodeDefault: NodeDefault<PluginTriggerNodeType> = {
errorMessage = t('workflow.errorMsg.fieldRequired', { field: field.label })
}
else {
if (value === undefined || value === null || value === '')
if (
value === undefined
|| value === null
|| value === ''
|| (Array.isArray(value) && value.length === 0)
)
errorMessage = t('workflow.errorMsg.fieldRequired', { field: field.label })
}
})