Skip to content

Commit

Permalink
Merge pull request #43126 from nextcloud/backport/43078/stable28
Browse files Browse the repository at this point in the history
[stable28] handle storage not available when expiring versions
  • Loading branch information
susnux authored Feb 2, 2024
2 parents 36f58ae + 27ac4e2 commit 30706d4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 30706d4

Please sign in to comment.