[stable34] fix: accept string node ids from the Files sidebar when requesting a signature - #8396
Merged
vitormattos merged 3 commits intoSep 14, 2026
Merged
Conversation
…gnature fix: keep string node ids from the Files sidebar when requesting a signature `tab.ts` builds `fileInfo.id` from `node.fileid ?? node.id`. With `@nextcloud/files`, `fileid` is the deprecated numeric getter and is `undefined` when the id does not fit a JavaScript number, while `id` is always a string; a file copied in the Files app and opened in the sidebar hits this path too. `AppFilesTab.update()` stored that string as `nodeId` unchanged, but `serializeRequestFile()` only accepted numbers, so the request went out without `file` and the API answered 422 "File or files parameter is required". Keep `nodeId` in the string domain instead of converting it: the serializer forwards a positive integer or a string of digits as it is, and the API accepts both. `fileId` and `id` only ever come from the LibreSign API as numbers and are not touched. The `FileInfo.id` type of `AppFilesTab` now matches what `tab.ts` sends. Tests follow the sidebar path with a node id above `Number.MAX_SAFE_INTEGER`: `tab.ts` keeps the string, `AppFilesTab` passes it through, and the store sends it unchanged for a single file and for envelope files; the empty id `tab.ts` falls back to is still not sent. Resolves: LibreSign#8363 Assisted-by: Claude Code:claude-opus-5 Signed-off-by: André Maia <andrefnkmm@gmail.com> Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This was referenced Sep 13, 2026
Closed
Backport of the backend part of LibreSign#8367 for stable34, at this branch's own boundary: the Files app sends node ids as strings (`Node.id` of `@nextcloud/files`, 64-bit since Nextcloud 33), and a string reached the services raw — `RequestSignatureService::saveFile()` swallowed the TypeError of `getByNodeId(int)` and `FileService::getNodeFromData()` propagated the one of `getFileByNodeId(int)` as a 422. `RequestSignatureController::normalizeNodeId()` turns a non-negative int or its canonical decimal string into an int once, for `file` and each entry of `files`, on both the create and the update entry points, and rejects anything else with the existing "Invalid fileID" error before it can reach a later cast. Same shape as the stable35 backport. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: André Maia <andrefnkmm@gmail.com>
The cherry-picked specs used helpers of the main test file (loadTabModule, getRegisteredTabConfig) and the requirement key of identify methods, none of which exist on this branch. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: André Maia <andrefnkmm@gmail.com>
maia-andre
force-pushed
the
backport/8367/stable34
branch
from
September 13, 2026 23:43
96bbd15 to
9efe4ce
Compare
Contributor
Author
|
Pushed two follow-ups: the specs carried by the bot's frontend commit used helpers of the |
|
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
vitormattos
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #8367 — replaces #8394, whose cherry-pick dropped the backend commit (conflict) and carried only the frontend one.
Two commits:
serializeRequestFile()forwards a stringnodeId,FileInfo.id: number | string, tests).stable35backport ([stable35] fix: accept string node ids from the Files sidebar when requesting a signature #8395): a privateRequestSignatureController::normalizeNodeId()turns a non-negative int or its canonical decimal string into an int once, forfileand each entry offiles, on both the create and the update entry points, and rejects anything else with the existing Invalid fileID error before it can reach a later cast. Nomainarchitecture brought in (this branch has noRequestSignatureWorkflowService/FileInputValidator).Tests:
RequestSignatureControllerTest— string normalized beforevalidateNewRequestToFile()/save(), each envelope entry, invalid value rejected with 422 before any service (run locally on this branch: 11 tests OK; php-cs-fixer clean).🤖 AI (if applicable)