Skip to content

fix(files_sharing): return external share id as integer in jsonSerialize()#60656

Open
deic-cloud wants to merge 3 commits into
nextcloud:masterfrom
deic-dk:fix/external-share-id-type
Open

fix(files_sharing): return external share id as integer in jsonSerialize()#60656
deic-cloud wants to merge 3 commits into
nextcloud:masterfrom
deic-dk:fix/external-share-id-type

Conversation

@deic-cloud
Copy link
Copy Markdown

Summary

ExternalShare::jsonSerialize() was returning id as a string via (string)$this->getId(). The @nextcloud/files Node constructor validates that id is a number and throws "Invalid id type of value" when it receives a string, causing federated/external share nodes to fail construction in the Files app.

Change: 'id' => (string)$this->getId()'id' => (int)$this->getId() in apps/files_sharing/lib/External/ExternalShare.php.

Test plan

  • Mount an external/federated share from another Nextcloud instance
  • Navigate to the share in the Files app — no console errors about "Invalid id type of value"
  • File operations (open, download, sidebar) work normally on the shared files

🤖 Generated with Claude Code

Worker Builder and others added 3 commits May 15, 2026 08:57
Signed-off-by: Worker Builder <worker-builder@nextcloud.com>
ExternalShare::jsonSerialize() was returning the id as a PHP string via
(string)$this->getId(). Since share IDs are snowflake bigints that exceed
Number.MAX_SAFE_INTEGER, the @nextcloud/files Node constructor rejects
them with "Invalid id type of value" when it validates typeof id === "number".

Casting to int preserves the full 64-bit value within PHP while producing
a JSON number, which satisfies the Node constructor's type check.

Signed-off-by: Frederik Orellana <frederik@orellana.dk>
@deic-cloud deic-cloud requested a review from a team as a code owner May 22, 2026 12:26
@deic-cloud deic-cloud requested review from ArtificialOwl, come-nc, leftybournes and provokateurin and removed request for a team May 22, 2026 12:26
@@ -94,7 +94,7 @@ public function setShareWith(IUser|IGroup $shareWith): void {
public function jsonSerialize(): array {
$parent = $this->getParent();
return [
'id' => (string)$this->getId(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. the id is a 64bits integer and that can't be serialized as json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants