Skip to content

fix: extract file descriptor when items have nested 'file' key (#7343)#7389

Merged
vitormattos merged 2 commits intomainfrom
fix/7343-multiple-files-from-picker
Apr 3, 2026
Merged

fix: extract file descriptor when items have nested 'file' key (#7343)#7389
vitormattos merged 2 commits intomainfrom
fix/7343-multiple-files-from-picker

Conversation

@vitormattos
Copy link
Copy Markdown
Member

Summary

Fixes #7343 — "Unable to add multiples files when choosing PDFs from Files"

Root cause

When the user selects multiple PDFs via Choose from Files, the frontend sends each item in the files array as:

{ "file": { "path": "/foo.pdf" }, "name": "foo" }

RequestSignatureService::processFileData() was forwarding the entire item as the 'file' key to FileService::getNodeFromData():

$sourceNode = $this->fileService->getNodeFromData([
    'file' => $fileData,   // passed the whole wrapper — double-nested
    ...
]);

This made $data['file'] = ['file' => ['path' => '...'], 'name' => '...']. Since getNodeFromData() looks for $data['file']['path'] (one level deep), it fell through to getContentFromData() which threw "No file source provided".

Fix

Extract the inner file descriptor: use $fileData['file'] when present, otherwise fall back to $fileData itself:

'file' => $fileData['file'] ?? $fileData,

This preserves backward compatibility: callers that already pass a bare file descriptor (['path' => '...']) are unaffected.

Testing

  • Added regression test testSaveEnvelopeExtractsFileDescriptorFromNestedFilesArrayItems that verifies getNodeFromData receives the inner descriptor (without the double-nested wrapper).
  • Test fails before the fix and passes after.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When the frontend sends multiple files via 'Choose from Files',
each item in the files array has the shape:
  { file: { path: '...' }, name: 'filename' }

processFileData() was passing the whole item as 'file' to
getNodeFromData(), creating a double-nested file.file.path
structure that getNodeFromData() cannot resolve, triggering
the 'No file source provided' exception.

Fix: extract fileData['file'] if present, otherwise fall back
to using fileData itself as the descriptor.

Fixes #7343

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Apr 3, 2026
@vitormattos vitormattos added this to the Next Major (34) milestone Apr 3, 2026
@vitormattos
Copy link
Copy Markdown
Member Author

/backport to stable33

@vitormattos
Copy link
Copy Markdown
Member Author

/backport to stable32

@vitormattos vitormattos merged commit 0840916 into main Apr 3, 2026
77 checks passed
@vitormattos vitormattos deleted the fix/7343-multiple-files-from-picker branch April 3, 2026 21:56
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

Unable to add multiples files when choosing PDFs from Files

1 participant