@@ -100,7 +100,7 @@ private function formatFolder(array $folder): array {
100
100
* Gets all Groupfolders
101
101
* @NoAdminRequired
102
102
* @param bool $applicable Filter by applicable groups
103
- * @return DataResponse<Http::STATUS_OK, list< GroupFoldersFolder>, array{}>
103
+ * @return DataResponse<Http::STATUS_OK, array<string, GroupFoldersFolder>, array{}>
104
104
* @throws OCSNotFoundException Storage not found
105
105
*
106
106
* 200: Groupfolders returned
@@ -111,8 +111,11 @@ public function getFolders(bool $applicable = false): DataResponse {
111
111
throw new OCSNotFoundException ();
112
112
}
113
113
114
- $ folders = array_values ($ this ->manager ->getAllFoldersWithSize ($ storageId ));
115
- $ folders = array_map ($ this ->formatFolder (...), $ folders );
114
+ $ folders = [];
115
+ foreach ($ this ->manager ->getAllFoldersWithSize ($ storageId ) as $ id => $ folder ) {
116
+ // Make them string-indexed for OpenAPI JSON output
117
+ $ folders [(string )$ id ] = $ this ->formatFolder ($ folder );
118
+ }
116
119
$ isAdmin = $ this ->delegationService ->isAdminNextcloud () || $ this ->delegationService ->isDelegatedAdmin ();
117
120
if ($ isAdmin && !$ applicable ) {
118
121
return new DataResponse ($ folders );
@@ -121,7 +124,7 @@ public function getFolders(bool $applicable = false): DataResponse {
121
124
$ folders = $ this ->foldersFilter ->getForApiUser ($ folders );
122
125
}
123
126
if ($ applicable || !$ this ->delegationService ->hasApiAccess ()) {
124
- $ folders = array_values ( array_filter (array_map ($ this ->filterNonAdminFolder (...), $ folders) ));
127
+ $ folders = array_filter (array_map ($ this ->filterNonAdminFolder (...), $ folders ));
125
128
}
126
129
return new DataResponse ($ folders );
127
130
}
0 commit comments