]> source.dussan.org Git - nextcloud-server.git/commitdiff
make sure that the umount hook always contains the path relative to data/user/files
authorBjoern Schiessle <schiessle@owncloud.com>
Wed, 2 Jul 2014 15:53:54 +0000 (17:53 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Fri, 4 Jul 2014 08:34:54 +0000 (10:34 +0200)
apps/files_encryption/hooks/hooks.php
lib/private/files/view.php

index 3625d5a09f3ac3de581081547e32bcbe75718649..7303cd080e5e76aadca5d190ea8a9b5cd1769c19 100644 (file)
@@ -441,7 +441,7 @@ class Hooks {
                        $ownerOld = self::$renamedFiles[$params['oldpath']]['uid'];\r
                        $pathOld = self::$renamedFiles[$params['oldpath']]['path'];\r
                } else {\r
-                       \OCP\Util::writeLog('Encryption library', "can't get path and owner from the file before it was renamed", \OCP\Util::ERROR);\r
+                       \OCP\Util::writeLog('Encryption library', "can't get path and owner from the file before it was renamed", \OCP\Util::DEBUG);\r
                        return false;\r
                }\r
 \r
index 1a9b0e8d2ae8dae037d0bf9b1aeb57d8708e09cb..2af693d5a645b55ea7c8b05c847965b7e36ec939 100644 (file)
@@ -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'));
        }