From 5ea1bd92c07a8aab42a13f057a91b5dc6d54e0f5 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 25 Nov 2026 15:55:24 -0800 Subject: [PATCH] Fix/change: only split password list on new lines (#14869) --- docs/usage.md | 2 +- .../workflow-edit-dialog.component.spec.ts | 27 +++++++++++++++++++ .../workflow-edit-dialog.component.ts | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 0cc10269b..aa054e741 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -659,7 +659,7 @@ will be aborted and the file will be deleted. "Password Removal" actions attempt to remove password protection from encrypted PDF documents. You can specify: -- One or more passwords to try, separated by commas or new lines +- One or more passwords to try, one per line (commas within a password are supported) - Each password is tried in order until one successfully unlocks the document Password removal never modifies a file in place. Instead, once a working password is found, the 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 a3c4bd64c..2249998f8 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 @@ -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', 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 6b1b80bd0..66677095b 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 @@ -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) }