Skip to content

Commit 79e3021

Browse files
committed
[Fix-18389][UI] Treat whitespace-only inline json as absent in the datax validator
1 parent 8e317d7 commit 79e3021

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

  • dolphinscheduler-ui/src/views/projects/task/components/node/fields

dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datax.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,15 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
210210
typeof fullName === 'string' &&
211211
fullName.toLowerCase().endsWith('.json')
212212
).length === 1
213-
if (
214-
model.json === '' ||
213+
// Treat a whitespace-only value as absent too, matching the backend
214+
// DataxParameters.isInlineJsonAbsent which uses StringUtils.isBlank. Otherwise a
215+
// blank inline json would reach utils.isJson below and be rejected even when exactly
216+
// one valid .json resource is attached, a configuration the worker would have accepted.
217+
const inlineJsonAbsent =
215218
model.json === undefined ||
216-
model.json === null
217-
) {
219+
model.json === null ||
220+
(model.json as string).trim() === ''
221+
if (inlineJsonAbsent) {
218222
return hasSingleJsonResource
219223
? undefined
220224
: new Error(t('project.node.datax_custom_json_resource_tips'))

0 commit comments

Comments
 (0)