Skip to content

[stable34] fix: accept string node ids from the Files sidebar when requesting a signature - #8396

Merged
vitormattos merged 3 commits into
LibreSign:stable34from
maia-andre:backport/8367/stable34
Sep 14, 2026
Merged

vitormattos merged 3 commits into
LibreSign:stable34from
maia-andre:backport/8367/stable34

Conversation

@maia-andre

Copy link
Copy Markdown
Contributor

Backport of #8367 — replaces #8394, whose cherry-pick dropped the backend commit (conflict) and carried only the frontend one.

Two commits:

  1. The bot's frontend commit, unchanged (serializeRequestFile() forwards a string nodeId, FileInfo.id: number | string, tests).
  2. A branch-specific backend fix, the same shape as the stable35 backport ([stable35] fix: accept string node ids from the Files sidebar when requesting a signature #8395): a private 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. No main architecture brought in (this branch has no RequestSignatureWorkflowService / FileInputValidator).

Tests: RequestSignatureControllerTest — string normalized before validateNewRequestToFile() / 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)

  • The content of this PR was partially or fully generated using AI

…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>
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
maia-andre force-pushed the backport/8367/stable34 branch from 96bbd15 to 9efe4ce Compare September 13, 2026 23:43
@maia-andre

Copy link
Copy Markdown
Contributor Author

Pushed two follow-ups: the specs carried by the bot's frontend commit used helpers of the main test file (loadTabModule, getRegisteredTabConfig) and the requirement key of identify methods, which do not exist on this branch (the same reason the bot's own PR fails test/typescript) — adapted to this branch's helpers, 120/120 locally; and createSignatureRequest() now declares its return type, since psalm stopped inferring it through the new normalization step.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
src/components/RightSidebar/AppFilesTab.vue 82.52% <ø> (ø)
src/store/files.js 75.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-project-automation github-project-automation Bot moved this from 0. Backlog to 1. to do in Roadmap Sep 14, 2026
@vitormattos
vitormattos merged commit 8097a47 into LibreSign:stable34 Sep 14, 2026
64 checks passed
@github-project-automation github-project-automation Bot moved this from 1. to do to 4. to release in Roadmap Sep 14, 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.

3 participants