[Pkg-owncloud-commits] [owncloud] 02/79: make sure that we emit the hooks if a file gets moved from a subfolder to the root folder with the nodes API

David Prévot taffit at moszumanska.debian.org
Tue Sep 1 20:55:32 UTC 2015


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

taffit pushed a commit to branch stable8
in repository owncloud.

commit 2c83115a3d76f3f15011bf15dbb5bd588940eb3f
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Tue Jul 28 15:24:46 2015 +0200

    make sure that we emit the hooks if a file gets moved from a subfolder to the root folder with the nodes API
---
 lib/private/files/view.php | 9 +++++++--
 tests/lib/files/view.php   | 4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 1706818..7379d82 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -642,10 +642,10 @@ class View {
 			}
 
 			$run = true;
-			if ($this->shouldEmitHooks() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2))) {
+			if ($this->shouldEmitHooks($path1) && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2))) {
 				// if it was a rename from a part file to a regular file it was a write and not a rename operation
 				$this->emit_file_hooks_pre($exists, $path2, $run);
-			} elseif ($this->shouldEmitHooks()) {
+			} elseif ($this->shouldEmitHooks($path1)) {
 				\OC_Hook::emit(
 					Filesystem::CLASSNAME, Filesystem::signal_rename,
 					array(
@@ -1087,6 +1087,11 @@ class View {
 			return true;
 		}
 		$fullPath = $this->getAbsolutePath($path);
+
+		if ($fullPath === $defaultRoot) {
+			return true;
+		}
+
 		return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/');
 	}
 
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 382c033..63a8138 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -1329,7 +1329,9 @@ class View extends \Test\TestCase {
 			['/foo/files/bar', '/foo', true],
 			['/foo', '/foo', false],
 			['/foo', '/files/foo', true],
-			['/foo', 'filesfoo', false]
+			['/foo', 'filesfoo', false],
+			['', '/foo/files', true],
+			['', '/foo/files/bar.txt', true]
 		];
 	}
 

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