mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-07 11:23:18 +00:00
Fix: prevent workflow passwords field type error (#13552)
This commit is contained in:
+24
@@ -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([])
|
||||
})
|
||||
})
|
||||
|
||||
+2
-3
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user