From 63c67f255ffbdde23e39ca31322ecf1efbcadb83 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 14 Dec 2020 00:15:59 -0300 Subject: [PATCH 1/2] Remove bad code Signed-off-by: Vitor Mattos --- lib/Operation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Operation.php b/lib/Operation.php index e1402c2..3bb98a5 100644 --- a/lib/Operation.php +++ b/lib/Operation.php @@ -91,7 +91,7 @@ protected function buildCommand(string $template, Node $node, string $event, arr $command = str_replace('%n', escapeshellarg(str_replace($base_path . '/', '', $path)), $command); } - if (false && strpos($command, '%f')) { + if (strpos($command, '%f')) { try { $view = new View($node->getParent()->getPath()); if ($node instanceof Folder) { From e6582a49f486b8f20b1423012382a1812a80d359 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 14 Dec 2020 10:32:54 -0300 Subject: [PATCH 2/2] Fix duplicated path Signed-off-by: Vitor Mattos --- lib/Operation.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Operation.php b/lib/Operation.php index 3bb98a5..aa4dafa 100644 --- a/lib/Operation.php +++ b/lib/Operation.php @@ -93,7 +93,7 @@ protected function buildCommand(string $template, Node $node, string $event, arr if (strpos($command, '%f')) { try { - $view = new View($node->getParent()->getPath()); + $view = new View(); if ($node instanceof Folder) { $fullPath = $view->getLocalFolder($node->getPath()); } else { @@ -102,7 +102,6 @@ protected function buildCommand(string $template, Node $node, string $event, arr if ($fullPath === null) { throw new \InvalidArgumentException(); } - //$fullPath = $node->getParent()->getFullPath($node->getPath()); $command = str_replace('%f', escapeshellarg($fullPath), $command); } catch (\Exception $e) { throw new \InvalidArgumentException('Could not determine full path');