aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorgreta <gretadoci@gmail.com>2024-07-25 13:39:57 +0200
committergreta <gretadoci@gmail.com>2024-07-25 14:46:06 +0200
commit26d22881e5ed136762d1f949d600a9113836806a (patch)
tree92302ae64f1d9062f960b307f28cb5cd7645256c /apps/files_versions
parente989feb006236cfecba93e3fb23b1dff9043eb0f (diff)
downloadnextcloud-server-26d22881e5ed136762d1f949d600a9113836806a.tar.gz
nextcloud-server-26d22881e5ed136762d1f949d600a9113836806a.zip
fix: add a try and catch for delete versioning
Signed-off-by: greta <gretadoci@gmail.com>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/Storage.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 0a4008359c2..d3e080b9dd2 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -28,6 +28,7 @@ use OCP\Files\IMimeTypeDetector;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
+use OCP\Files\NotPermittedException;
use OCP\Files\Search\ISearchBinaryOperator;
use OCP\Files\Search\ISearchComparison;
use OCP\Files\StorageInvalidException;
@@ -593,8 +594,12 @@ class Storage {
$versionsMapper->delete($versionEntity);
}
- $version->delete();
- \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
+ try {
+ $version->delete();
+ \OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
+ } catch (NotPermittedException $e) {
+ \OCP\Server::get(LoggerInterface::class)->error("Missing permissions to delete version: {$internalPath}", ['app' => 'files_versions', 'exception' => $e]);
+ }
}
}