From 4edb96080ded280cbcf47cca84f8f133278f6bb1 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 668b86c059a..e9855eebe91 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -268,6 +268,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; }