aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis <louis@chmn.me>2023-11-06 09:50:14 +0100
committerGitHub <noreply@github.com>2023-11-06 09:50:14 +0100
commit40c8e587b220ca037c5487311d4f1bf78d7e80b7 (patch)
tree7a298259b38768bff8b20a596330e7409598b421
parent738faf4135797bae08397883befb53c3f86c3c11 (diff)
parentffeef99abc934dc576e1a44ec3f33e7966ad046b (diff)
downloadnextcloud-server-40c8e587b220ca037c5487311d4f1bf78d7e80b7.tar.gz
nextcloud-server-40c8e587b220ca037c5487311d4f1bf78d7e80b7.zip
Merge pull request #41173 from nextcloud/deleteGhostVersion
fix: Delete ghost versions of non-existing files
-rw-r--r--apps/files_versions/lib/Storage.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 30f5c8073a1..56d9a8343c6 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -592,14 +592,17 @@ class Storage {
throw new DoesNotExistException('Could not find relative path of (' . $info->getPath() . ')');
}
- $node = $userFolder->get(substr($path, 0, -strlen('.v'.$version)));
try {
+ $node = $userFolder->get(substr($path, 0, -strlen('.v'.$version)));
$versionEntity = $versionsMapper->findVersionForFileId($node->getId(), $version);
$versionEntities[$info->getId()] = $versionEntity;
if ($versionEntity->getLabel() !== '') {
return false;
}
+ } catch (NotFoundException $e) {
+ // Original node not found, delete the version
+ return true;
} 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.