From: Bjoern Schiessle Date: Thu, 19 Dec 2013 17:40:40 +0000 (+0100) Subject: check if the old owner and the old path is available X-Git-Tag: v7.0.0alpha2~1000^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=552d0a6feb137ad1144312c6e6eef1c295e41572;p=nextcloud-server.git check if the old owner and the old path is available --- diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 3e453e210f3..09d5687e226 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -484,7 +484,7 @@ class Hooks { /** * @brief mark file as renamed so that we know the original source after the file was renamed - * @param string $path + * @param array $params with the old path and the new path */ public static function preRename($params) { $util = new Util(new \OC_FilesystemView('/'), \OCP\User::getUser()); @@ -516,8 +516,15 @@ class Hooks { $userId = \OCP\User::getUser(); $util = new Util($view, $userId); - $ownerOld = self::$renamedFiles[$params['oldpath']]['uid']; - $pathOld = self::$renamedFiles[$params['oldpath']]['path']; + if (isset(self::$renamedFiles[$params['oldpath']]['uid']) && + isset(self::$renamedFiles[$params['oldpath']]['path'])) { + $ownerOld = self::$renamedFiles[$params['oldpath']]['uid']; + $pathOld = self::$renamedFiles[$params['oldpath']]['path']; + } else { + \OCP\Util::writeLog('Encryption library', "can't get path and owner from the file before it was renamed", \OCP\Util::ERROR); + return false; + } + list($ownerNew, $pathNew) = $util->getUidAndFilename($params['newpath']); // Format paths to be relative to user files dir