Skip to content

Commit

Permalink
fix: do not use removed View::getLocalFolder()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
blizzz authored and backportbot-nextcloud[bot] committed Jun 8, 2023
1 parent 2abdb89 commit 88783fd
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 88783fd

Please sign in to comment.