Fix: prevent workflow passwords field type error (#13552)

This commit is contained in:
shamoon
2026-08-05 01:46:08 -07:00
committed by GitHub
parent e86adb6c36
commit 47727de116
2 changed files with 26 additions and 3 deletions
@@ -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([])
})
})
@@ -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)
}