From cb54510d8f92f8d177878fcaa7db9bb579b2b3ad Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 24 Jan 2024 10:46:02 +0100 Subject: [PATCH] handle storage not available when expiring versions Signed-off-by: Robin Appelman --- apps/files_versions/lib/Storage.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 997d6788a6f86..c1b261242e34b 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -63,6 +63,7 @@ use OCP\Files\NotFoundException; use OCP\Files\Search\ISearchBinaryOperator; use OCP\Files\Search\ISearchComparison; +use OCP\Files\StorageInvalidException; use OCP\Files\StorageNotAvailableException; use OCP\IURLGenerator; use OCP\IUser; @@ -603,6 +604,10 @@ public static function expireOlderThanMaxForUser($uid) { } catch (NotFoundException $e) { // Original node not found, delete the version return true; + } catch (StorageNotAvailableException | StorageInvalidException $e) { + // Storage can't be used, but it might only be temporary so we can't always delete the version + // since we can't determine if the version is named we take the safe route and don't expire + return false; } catch (DoesNotExistException $ex) { // Version on FS can have no equivalent in the DB if they were created before the version naming feature. // So we ignore DoesNotExistException.