summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2023-10-28 14:47:19 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2023-12-04 20:52:57 +0100
commitde7e4e1612ae7f61c59d2a35b1ef9864e7e52331 (patch)
tree40ccb6e1cf067ff4ac7c5b78df0de65b9a4e6225 /apps/files_versions
parentd1333757a523e19cacc3feaeaf43777f78a7fc73 (diff)
downloadnextcloud-server-de7e4e1612ae7f61c59d2a35b1ef9864e7e52331.tar.gz
nextcloud-server-de7e4e1612ae7f61c59d2a35b1ef9864e7e52331.zip
fix: Delete ghost versions of non-existing files
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'apps/files_versions')
-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.