From 18964750f986f7d64344679b954b4e6fc93023dc Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 10 Dec 2025 11:05:40 +0100 Subject: [PATCH] fix(openapi): Fix returned types from external share We always been returning an int for for accepted, but since it was returned as a mixed from the DB, psalm never complained about the fact this was typed as a bool in the API doc. Signed-off-by: Carl Schwan --- apps/files_sharing/lib/Controller/RemoteController.php | 7 ++++--- apps/files_sharing/lib/ResponseDefinitions.php | 2 +- apps/files_sharing/openapi.json | 3 ++- openapi.json | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/files_sharing/lib/Controller/RemoteController.php b/apps/files_sharing/lib/Controller/RemoteController.php index 4b87db488b5..590ebdd5d94 100644 --- a/apps/files_sharing/lib/Controller/RemoteController.php +++ b/apps/files_sharing/lib/Controller/RemoteController.php @@ -108,16 +108,17 @@ class RemoteController extends OCSController { * @return Files_SharingRemoteShare Enriched share info with data from the filecache */ private function extendShareInfo(ExternalShare $share): array { + $shareData = $share->jsonSerialize(); + + $shareData['parent'] = $shareData['parent'] !== '-1' ? $shareData['parent'] : null; $userFolder = $this->rootFolder->getUserFolder($this->userId); try { $mountPointNode = $userFolder->get($share->getMountpoint()); } catch (\Exception) { - return $share->jsonSerialize(); + return $shareData; } - $shareData = $share->jsonSerialize(); - $shareData['mimetype'] = $mountPointNode->getMimetype(); $shareData['mtime'] = $mountPointNode->getMTime(); $shareData['permissions'] = $mountPointNode->getPermissions(); diff --git a/apps/files_sharing/lib/ResponseDefinitions.php b/apps/files_sharing/lib/ResponseDefinitions.php index 35e66c5d1f7..58277577eab 100644 --- a/apps/files_sharing/lib/ResponseDefinitions.php +++ b/apps/files_sharing/lib/ResponseDefinitions.php @@ -89,7 +89,7 @@ namespace OCA\Files_Sharing; * mtime: int|null, * name: string, * owner: string, - * parent: string, + * parent: string|null, * permissions: int|null, * remote: string, * remote_id: string, diff --git a/apps/files_sharing/openapi.json b/apps/files_sharing/openapi.json index d2e80654ce3..dc89752f091 100644 --- a/apps/files_sharing/openapi.json +++ b/apps/files_sharing/openapi.json @@ -408,7 +408,8 @@ ], "properties": { "accepted": { - "type": "boolean" + "type": "integer", + "format": "int64" }, "file_id": { "type": "integer", diff --git a/openapi.json b/openapi.json index 94b9dfd8569..7aff72d29a1 100644 --- a/openapi.json +++ b/openapi.json @@ -2515,7 +2515,8 @@ ], "properties": { "accepted": { - "type": "boolean" + "type": "integer", + "format": "int64" }, "file_id": { "type": "integer",