]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: add a try and catch for delete versioning 46757/head
authorgreta <gretadoci@gmail.com>
Thu, 25 Jul 2024 11:39:57 +0000 (13:39 +0200)
committerFerdinand Thiessen <opensource@fthiessen.de>
Thu, 25 Jul 2024 21:14:27 +0000 (23:14 +0200)
Signed-off-by: greta <gretadoci@gmail.com>
apps/files_versions/lib/Storage.php

index 07bd6b164d273dd71d94aa02426aef0f86dfb5fc..d01d6afd3960d57f55d18ba0a018ea5cff27501b 100644 (file)
@@ -61,6 +61,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;
@@ -626,8 +627,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]);
+                       }
                }
        }