fix(files_sharing): return external share id as integer in jsonSerialize()#60656
Open
deic-cloud wants to merge 3 commits into
Open
fix(files_sharing): return external share id as integer in jsonSerialize()#60656deic-cloud wants to merge 3 commits into
deic-cloud wants to merge 3 commits into
Conversation
Signed-off-by: Worker Builder <worker-builder@nextcloud.com>
[stable34] 34.0.0 RC1
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>
CarlSchwan
reviewed
May 22, 2026
| @@ -94,7 +94,7 @@ public function setShareWith(IUser|IGroup $shareWith): void { | |||
| public function jsonSerialize(): array { | |||
| $parent = $this->getParent(); | |||
| return [ | |||
| 'id' => (string)$this->getId(), | |||
Member
There was a problem hiding this comment.
This is wrong. the id is a 64bits integer and that can't be serialized as json
Member
There was a problem hiding this comment.
we now support both int and string as ids in @nextcloud/files
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.
Summary
ExternalShare::jsonSerialize()was returningidas a string via(string)$this->getId(). The@nextcloud/filesNodeconstructor validates thatidis 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()inapps/files_sharing/lib/External/ExternalShare.php.Test plan
🤖 Generated with Claude Code