]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: add a try and catch for delete versioning 46749/head
authorgreta <gretadoci@gmail.com>
Thu, 25 Jul 2024 11:39:57 +0000 (13:39 +0200)
committergreta <gretadoci@gmail.com>
Thu, 25 Jul 2024 12:46:06 +0000 (14:46 +0200)
Signed-off-by: greta <gretadoci@gmail.com>
apps/files_versions/lib/Storage.php

index 0a4008359c20ba59727dd1bd6f36b9d7a879e3a4..d3e080b9dd2e4945b688c72e8f4376575d73ad02 100644 (file)
@@ -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]);
+                       }
                }
        }