Skip to content

Commit

Permalink
Merge pull request #177 from nextcloud/backport/175/stable27
Browse files Browse the repository at this point in the history
[stable27] fix: do not use removed View::getLocalFolder()
  • Loading branch information
blizzz authored Jun 8, 2023
2 parents 2abdb89 + 88783fd commit 2f26926
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2f26926

Please sign in to comment.