Merge pull request #17932 from owncloud/fix_move_files
make sure that hooks are emitted properly on file move operation
This commit is contained in:
commit
d5bba42030
|
@ -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 . '/');
|
||||
}
|
||||
|
||||
|
|
|
@ -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]
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue