aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-08-11 13:54:09 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-08-11 13:54:09 +0200
commitd5bba42030b0243967baecb86baf46209ce556f4 (patch)
tree3f2186a4806d160be396c2ab782bea439633a01a
parent0abc637782aec1745f9445f193ccc3b9a95ba77d (diff)
parentfb4c99fe0671c8eaff1f1024d71b9d7a12968e8e (diff)
downloadnextcloud-server-d5bba42030b0243967baecb86baf46209ce556f4.tar.gz
nextcloud-server-d5bba42030b0243967baecb86baf46209ce556f4.zip
Merge pull request #17932 from owncloud/fix_move_files
make sure that hooks are emitted properly on file move operation
-rw-r--r--lib/private/files/view.php9
-rw-r--r--tests/lib/files/view.php4
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index dc6e8aaa719..9afa9d40b20 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 bf99a582117..bb42f385fc5 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -1386,7 +1386,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]
];
}