mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-26 06:57:37 +00:00
Fix/change: only split password list on new lines (#14869)
This commit is contained in:
1 parent
0a1bdad96b
commit
5ea1bd92c0
3 files changed
+29
-2
No files matched your search
+27
@@ -1290,6 +1290,33 @@ describe('WorkflowEditDialogComponent', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('should preserve commas in passwords when saving', () => {
|
||||
component.object = {
|
||||
name: 'Workflow with comma in password',
|
||||
id: 1,
|
||||
order: 1,
|
||||
enabled: true,
|
||||
triggers: [],
|
||||
actions: [
|
||||
{
|
||||
id: 1,
|
||||
type: WorkflowActionType.PasswordRemoval,
|
||||
passwords: ['first,part', 'second'],
|
||||
},
|
||||
],
|
||||
}
|
||||
component.ngOnInit()
|
||||
|
||||
const formActions = component.objectForm.get('actions') as FormArray
|
||||
expect(formActions.value[0].passwords).toBe('first,part\nsecond')
|
||||
component.save()
|
||||
|
||||
expect(component.objectForm.get('actions').value[0].passwords).toEqual([
|
||||
'first,part',
|
||||
'second',
|
||||
])
|
||||
})
|
||||
|
||||
it('should parse passwords again when retrying a failed save', () => {
|
||||
component.object = {
|
||||
name: 'Workflow with blank Passwords',
|
||||
|
||||
+1
-1
@@ -1332,7 +1332,7 @@ export class WorkflowEditDialogComponent
|
||||
}
|
||||
|
||||
private parsePasswords(value: string | string[] = ''): string[] {
|
||||
return (Array.isArray(value) ? value : value.split(/[\n,]+/))
|
||||
return (Array.isArray(value) ? value : value.split('\n'))
|
||||
.map((entry) => entry.trim())
|
||||
.filter((entry) => entry.length > 0)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user