From b6bf6ae4ac035f151a6610fc6fbca458a7c48d31 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 7 Jun 2023 22:15:45 +0200 Subject: [PATCH] fix: do not use removed View::getLocalFolder() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actually without replacement. Prior to NC 27 it was implemented on local storage only, trying to run it would have led into an Exception – if folders were not filtered out here already. Since the method would actually only make sense for external folders, removing it seems to be the reasonable decision, and actually does not remove functionality. Signed-off-by: Arthur Schiwon --- lib/Operation.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Operation.php b/lib/Operation.php index f4bad39..3dbfc7d 100644 --- a/lib/Operation.php +++ b/lib/Operation.php @@ -36,7 +36,7 @@ use OCP\BackgroundJob\IJobList; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\GenericEvent; -use OCP\Files\Folder; +use OCP\Files\File as FileNode; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; use OCP\Files\Node; @@ -145,7 +145,7 @@ public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatch // '', admin, 'files', 'path/to/file.txt' [, , $folder,] = explode('/', $node->getPath(), 4); - if ($folder !== 'files' || $node instanceof Folder) { + if ($folder !== 'files' || !($node instanceof FileNode)) { return; } @@ -196,9 +196,7 @@ protected function buildCommand(string $template, Node $node, string $event, arr if (strpos($command, '%f')) { try { $view = new View(); - if ($node instanceof Folder) { - $fullPath = $view->getLocalFolder($node->getPath()); - } else { + if ($node instanceof FileNode) { $fullPath = $view->getLocalFile($node->getPath()); } if ($fullPath === null) {