[Pkg-owncloud-commits] [owncloud] 21/70: make sure that the umount hook always contains the path relative to data/user/files

David Prévot taffit at moszumanska.debian.org
Mon Jul 14 17:38:04 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 0319ee3894fd6880c6a037ec9f85037576f06013
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Wed Jul 2 17:53:54 2014 +0200

    make sure that the umount hook always contains the path relative to data/user/files
---
 apps/files_encryption/hooks/hooks.php |  2 +-
 lib/private/files/view.php            | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 3625d5a..7303cd0 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -441,7 +441,7 @@ class Hooks {
 			$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);
+			\OCP\Util::writeLog('Encryption library', "can't get path and owner from the file before it was renamed", \OCP\Util::DEBUG);
 			return false;
 		}
 
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 1a9b0e8..2af693d 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -161,17 +161,27 @@ class View {
 		return $this->basicOperation('mkdir', $path, array('create', 'write'));
 	}
 
+	/**
+	 * remove mount point
+	 *
+	 * @param \OC\Files\Mount\MoveableMount $mount
+	 * @param string $path relative to data/
+	 * @return boolean
+	 */
 	protected function removeMount($mount, $path){
 		if ($mount instanceof MoveableMount) {
+			// cut of /user/files to get the relative path to data/user/files
+			$pathParts= explode('/', $path, 4);
+			$relPath = '/' . $pathParts[3];
 			\OC_Hook::emit(
 				Filesystem::CLASSNAME, "umount",
-				array(Filesystem::signal_param_path => $path)
+				array(Filesystem::signal_param_path => $relPath)
 			);
 			$result = $mount->removeMount();
 			if ($result) {
 				\OC_Hook::emit(
 					Filesystem::CLASSNAME, "post_umount",
-					array(Filesystem::signal_param_path => $path)
+					array(Filesystem::signal_param_path => $relPath)
 				);
 			}
 			return $result;
@@ -387,7 +397,7 @@ class View {
 		$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
 		$mount = Filesystem::getMountManager()->find($absolutePath . $postFix);
 		if ($mount->getInternalPath($absolutePath) === '') {
-			return $this->removeMount($mount, $path);
+			return $this->removeMount($mount, $absolutePath);
 		}
 		return $this->basicOperation('unlink', $path, array('delete'));
 	}

-- 
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