Skip to content

Commit 1896475

Browse files
committed
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 <[email protected]>
1 parent a011cb7 commit 1896475

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

apps/files_sharing/lib/Controller/RemoteController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,17 @@ public function declineShare(string $id): DataResponse {
108108
* @return Files_SharingRemoteShare Enriched share info with data from the filecache
109109
*/
110110
private function extendShareInfo(ExternalShare $share): array {
111+
$shareData = $share->jsonSerialize();
112+
113+
$shareData['parent'] = $shareData['parent'] !== '-1' ? $shareData['parent'] : null;
111114
$userFolder = $this->rootFolder->getUserFolder($this->userId);
112115

113116
try {
114117
$mountPointNode = $userFolder->get($share->getMountpoint());
115118
} catch (\Exception) {
116-
return $share->jsonSerialize();
119+
return $shareData;
117120
}
118121

119-
$shareData = $share->jsonSerialize();
120-
121122
$shareData['mimetype'] = $mountPointNode->getMimetype();
122123
$shareData['mtime'] = $mountPointNode->getMTime();
123124
$shareData['permissions'] = $mountPointNode->getPermissions();

apps/files_sharing/lib/ResponseDefinitions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
* mtime: int|null,
9090
* name: string,
9191
* owner: string,
92-
* parent: string,
92+
* parent: string|null,
9393
* permissions: int|null,
9494
* remote: string,
9595
* remote_id: string,

apps/files_sharing/openapi.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@
408408
],
409409
"properties": {
410410
"accepted": {
411-
"type": "boolean"
411+
"type": "integer",
412+
"format": "int64"
412413
},
413414
"file_id": {
414415
"type": "integer",

openapi.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,8 @@
25152515
],
25162516
"properties": {
25172517
"accepted": {
2518-
"type": "boolean"
2518+
"type": "integer",
2519+
"format": "int64"
25192520
},
25202521
"file_id": {
25212522
"type": "integer",

0 commit comments

Comments
 (0)