[Pkg-owncloud-commits] [owncloud] 24/104: check if the old owner and the old path is available

David Prévot taffit at moszumanska.debian.org
Sat Jan 18 13:33:37 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 672cbc53786e326ab0e648d6cde46c8f13c470eb
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Thu Dec 19 18:40:40 2013 +0100

    check if the old owner and the old path is available
---
 apps/files_encryption/hooks/hooks.php | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 3e453e2..09d5687 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list