diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index 296f90bd3..16355d52a 100755 --- a/lib/FilesHooks.php +++ b/lib/FilesHooks.php @@ -234,6 +234,9 @@ public function fileMove($oldPath, $newPath) { return; } + // cache moveCase result until attributes are calculated for next stage (fileMovePost) + // moveCase has to be set as last part before return + $moveCase = $this->moveCase; if (strpos($oldDir, $newDir) === 0) { /** * a/b/c moved to a/c @@ -243,7 +246,7 @@ public function fileMove($oldPath, $newPath) { * - a/b/ shared: delete * - a/ shared: move/rename */ - $this->moveCase = 'moveUp'; + $moveCase = 'moveUp'; } elseif (strpos($newDir, $oldDir) === 0) { /** * a/b moved to a/c/b @@ -253,7 +256,7 @@ public function fileMove($oldPath, $newPath) { * - a/c/ shared: add * - a/ shared: move/rename */ - $this->moveCase = 'moveDown'; + $moveCase = 'moveDown'; } else { /** * a/b/c moved to a/d/c @@ -264,7 +267,7 @@ public function fileMove($oldPath, $newPath) { * - a/d/ shared: add * - a/ shared: move/rename */ - $this->moveCase = 'moveCross'; + $moveCase = 'moveCross'; } [$this->oldParentPath, $this->oldParentOwner, $this->oldParentId] = $this->getSourcePathAndOwner($oldDir); @@ -283,6 +286,9 @@ public function fileMove($oldPath, $newPath) { } $this->oldAccessList = $oldAccessList; + + // now its save to set moveCase + $this->moveCase = $moveCase; } @@ -570,11 +576,21 @@ protected function getUserPathsFromPath($path, $uidOwner) { try { $node = $this->rootFolder->getUserFolder($uidOwner)->get($path); } catch (NotFoundException $e) { - return []; + $this->logger->warning('Path "{path}" with owner "{uidOwner}" was not found', + ['path'=> $path, 'uidOwner'=>$uidOwner]); + return [ + 'users' => [], + 'remotes' => [], + ]; } if (!$node instanceof Node) { - return []; + $this->logger->warning('Path "{path}" of "{uidOwner}" is not a valid type.', + ['path'=> $path, 'uidOwner'=>$uidOwner]); + return [ + 'users' => [], + 'remotes' => [], + ]; } $accessList = $this->shareHelper->getPathsForAccessList($node);