diff --git a/lib/private/Files/Node/HookConnector.php b/lib/private/Files/Node/HookConnector.php index a8e76d95c22c4..710dfe68e423a 100644 --- a/lib/private/Files/Node/HookConnector.php +++ b/lib/private/Files/Node/HookConnector.php @@ -92,6 +92,10 @@ public function viewToNode() { } public function write($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->root->emit('\OC\Files', 'preWrite', [$node]); $this->dispatcher->dispatch('\OCP\Files::preWrite', new GenericEvent($node)); @@ -101,6 +105,10 @@ public function write($arguments) { } public function postWrite($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->root->emit('\OC\Files', 'postWrite', [$node]); $this->dispatcher->dispatch('\OCP\Files::postWrite', new GenericEvent($node)); @@ -110,6 +118,10 @@ public function postWrite($arguments) { } public function create($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->root->emit('\OC\Files', 'preCreate', [$node]); $this->dispatcher->dispatch('\OCP\Files::preCreate', new GenericEvent($node)); @@ -119,6 +131,10 @@ public function create($arguments) { } public function postCreate($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->root->emit('\OC\Files', 'postCreate', [$node]); $this->dispatcher->dispatch('\OCP\Files::postCreate', new GenericEvent($node)); @@ -128,6 +144,10 @@ public function postCreate($arguments) { } public function delete($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->deleteMetaCache[$node->getPath()] = $node->getFileInfo(); $this->root->emit('\OC\Files', 'preDelete', [$node]); @@ -138,6 +158,10 @@ public function delete($arguments) { } public function postDelete($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); unset($this->deleteMetaCache[$node->getPath()]); $this->root->emit('\OC\Files', 'postDelete', [$node]); @@ -148,6 +172,10 @@ public function postDelete($arguments) { } public function touch($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->root->emit('\OC\Files', 'preTouch', [$node]); $this->dispatcher->dispatch('\OCP\Files::preTouch', new GenericEvent($node)); @@ -157,6 +185,10 @@ public function touch($arguments) { } public function postTouch($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->root->emit('\OC\Files', 'postTouch', [$node]); $this->dispatcher->dispatch('\OCP\Files::postTouch', new GenericEvent($node)); @@ -166,6 +198,10 @@ public function postTouch($arguments) { } public function rename($arguments) { + if (!is_string($arguments['oldpath']) || !is_string($arguments['newpath'])) { + return; + } + $source = $this->getNodeForPath($arguments['oldpath']); $target = $this->getNodeForPath($arguments['newpath']); $this->root->emit('\OC\Files', 'preRename', [$source, $target]); @@ -176,6 +212,10 @@ public function rename($arguments) { } public function postRename($arguments) { + if (!is_string($arguments['oldpath']) || !is_string($arguments['newpath'])) { + return; + } + $source = $this->getNodeForPath($arguments['oldpath']); $target = $this->getNodeForPath($arguments['newpath']); $this->root->emit('\OC\Files', 'postRename', [$source, $target]); @@ -186,6 +226,10 @@ public function postRename($arguments) { } public function copy($arguments) { + if (!is_string($arguments['oldpath']) || !is_string($arguments['newpath'])) { + return; + } + $source = $this->getNodeForPath($arguments['oldpath']); $target = $this->getNodeForPath($arguments['newpath']); $this->root->emit('\OC\Files', 'preCopy', [$source, $target]); @@ -196,6 +240,10 @@ public function copy($arguments) { } public function postCopy($arguments) { + if (!is_string($arguments['oldpath']) || !is_string($arguments['newpath'])) { + return; + } + $source = $this->getNodeForPath($arguments['oldpath']); $target = $this->getNodeForPath($arguments['newpath']); $this->root->emit('\OC\Files', 'postCopy', [$source, $target]); @@ -206,6 +254,10 @@ public function postCopy($arguments) { } public function read($arguments) { + if (!is_string($arguments['path'])) { + return; + } + $node = $this->getNodeForPath($arguments['path']); $this->root->emit('\OC\Files', 'read', [$node]); $this->dispatcher->dispatch('\OCP\Files::read', new GenericEvent([$node]));