]> source.dussan.org Git - nextcloud-server.git/commitdiff
handle storage not available when expiring versions 43078/head
authorRobin Appelman <robin@icewind.nl>
Wed, 24 Jan 2024 09:46:02 +0000 (10:46 +0100)
committerRobin Appelman <robin@icewind.nl>
Wed, 24 Jan 2024 09:49:38 +0000 (10:49 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_versions/lib/Storage.php

index 5e33059dcf81c0fe58cfeba4312063acbbf2790e..07bd6b164d273dd71d94aa02426aef0f86dfb5fc 100644 (file)
@@ -63,6 +63,7 @@ use OCP\Files\Node;
 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 @@ class Storage {
                        } 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.