diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts index cddfc32ee..bc7be5fad 100644 --- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts +++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts @@ -1019,4 +1019,28 @@ describe('WorkflowEditDialogComponent', () => { 'pass3', ]) }) + + it('should parse passwords again when retrying a failed save', () => { + component.object = { + name: 'Workflow with blank Passwords', + id: 1, + order: null, + enabled: true, + triggers: [], + actions: [ + { + id: 1, + type: WorkflowActionType.PasswordRemoval, + passwords: [], + }, + ], + } + component.ngOnInit() + + component.save() + component.objectForm.get('order').setValue(1) + + expect(() => component.save()).not.toThrow() + expect(component.objectForm.get('actions').value[0].passwords).toEqual([]) + }) }) diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts index ccc07bcc5..8e8dd6ef7 100644 --- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts @@ -1207,9 +1207,8 @@ export class WorkflowEditDialogComponent return passwords.join('\n') } - private parsePasswords(value: string = ''): string[] { - return value - .split(/[\n,]+/) + private parsePasswords(value: string | string[] = ''): string[] { + return (Array.isArray(value) ? value : value.split(/[\n,]+/)) .map((entry) => entry.trim()) .filter((entry) => entry.length > 0) }