From a5275678a6eaa193c071683b1baff199a7eace33 Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Fri, 5 Jul 2024 19:03:51 +0200 Subject: [PATCH 1/2] fix: check if array key exists Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/Controller/FolderController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Controller/FolderController.php b/lib/Controller/FolderController.php index 6ed421019..61a156f6b 100644 --- a/lib/Controller/FolderController.php +++ b/lib/Controller/FolderController.php @@ -304,9 +304,14 @@ private function buildOCSResponseXML(string $format, DataResponse $data): V1Resp } private function folderDataForXML(array $data): array { - $groups = $data['group_details']; + $groups = []; + + if (isset($data['group_details'])) { + $groups = $data['group_details']; + unset($data['group_details']); + } + $data['groups'] = []; - unset($data['group_details']); foreach ($groups as $id => $group) { $data['groups'][] = [ '@group_id' => $id, From 9c481bf15d3a819a4d702c4d6014b4608d1164cf Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:43:25 +0200 Subject: [PATCH 2/2] chore: small optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/Controller/FolderController.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/Controller/FolderController.php b/lib/Controller/FolderController.php index 61a156f6b..a2ed2262b 100644 --- a/lib/Controller/FolderController.php +++ b/lib/Controller/FolderController.php @@ -304,13 +304,8 @@ private function buildOCSResponseXML(string $format, DataResponse $data): V1Resp } private function folderDataForXML(array $data): array { - $groups = []; - - if (isset($data['group_details'])) { - $groups = $data['group_details']; - unset($data['group_details']); - } - + $groups = $data['group_details'] ?? []; + unset($data['group_details']); $data['groups'] = []; foreach ($groups as $id => $group) { $data['groups'][] = [