From 0336d31af78d9993ab07c3fab833104d4e536f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 12 Jan 2023 12:01:21 +0100 Subject: [PATCH] Catch Exceptions when loading storage data of users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids having the whole userlist crashing because a user external storage fails to load. With this change only the problematic user storage/quota information will be empty. Signed-off-by: Côme Chilliet --- apps/provisioning_api/lib/Controller/AUserData.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php index 0fc2bb6f0d3..5913cb51314 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -267,6 +267,16 @@ abstract class AUserData extends OCSController { self::USER_FIELD_QUOTA => $quota !== false ? $quota : 'none', 'used' => 0 ]; + } catch (\Exception $e) { + \OC::$server->get(\Psr\Log\LoggerInterface::class)->error( + "Could not load storage info for {user}", + [ + 'app' => 'provisioning_api', + 'user' => $userId, + 'exception' => $e, + ] + ); + return []; } return $data; }