Skip to content

Commit bf67d8f

Browse files
committed
fix(node): emit hooks on Node::copy()
When calling `Files\Node\Node::copy()`, `Files\View::copy()` gets called, but `Files\View::fakeRoot` is empty so the hooks are not emitted if no path is given to `Files\View::shouldEmitHooks()`. This results in node-related events like `NodeCopiedEvent` not being fired when copying files via `Files\Node\Node::copy()`. `Files\View::shouldEmitHooks()` is given a path as parameter in almost all places except when called from the `copy()` function. This commit changes it and passes the copy target path. Fixes: nextcloud/collectives#1756 Signed-off-by: Jonas <[email protected]>
1 parent 5734ffd commit bf67d8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/private/Files/View.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ public function copy($source, $target, $preserveMtime = false) {
938938

939939
try {
940940
$exists = $this->file_exists($target);
941-
if ($this->shouldEmitHooks()) {
941+
if ($this->shouldEmitHooks($target)) {
942942
\OC_Hook::emit(
943943
Filesystem::CLASSNAME,
944944
Filesystem::signal_copy,
@@ -978,7 +978,7 @@ public function copy($source, $target, $preserveMtime = false) {
978978
$this->changeLock($target, ILockingProvider::LOCK_SHARED);
979979
$lockTypePath2 = ILockingProvider::LOCK_SHARED;
980980

981-
if ($this->shouldEmitHooks() && $result !== false) {
981+
if ($this->shouldEmitHooks($target) && $result !== false) {
982982
\OC_Hook::emit(
983983
Filesystem::CLASSNAME,
984984
Filesystem::signal_post_copy,

0 commit comments

Comments
 (0)