Skip to content

Commit c130079

Browse files
authored
Merge pull request #43078 from nextcloud/version-expire-handle-storage
handle storage not available when expiring versions
2 parents d4c0d15 + 6fbf22e commit c130079

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apps/files_versions/lib/Storage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
use OCP\Files\NotFoundException;
6464
use OCP\Files\Search\ISearchBinaryOperator;
6565
use OCP\Files\Search\ISearchComparison;
66+
use OCP\Files\StorageInvalidException;
6667
use OCP\Files\StorageNotAvailableException;
6768
use OCP\IURLGenerator;
6869
use OCP\IUser;
@@ -603,6 +604,10 @@ public static function expireOlderThanMaxForUser($uid) {
603604
} catch (NotFoundException $e) {
604605
// Original node not found, delete the version
605606
return true;
607+
} catch (StorageNotAvailableException | StorageInvalidException $e) {
608+
// Storage can't be used, but it might only be temporary so we can't always delete the version
609+
// since we can't determine if the version is named we take the safe route and don't expire
610+
return false;
606611
} catch (DoesNotExistException $ex) {
607612
// Version on FS can have no equivalent in the DB if they were created before the version naming feature.
608613
// So we ignore DoesNotExistException.

0 commit comments

Comments
 (0)