Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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]>
  • Loading branch information
mejo- committed May 27, 2025
commit c952570e6700906cbed71a7036e68211b38936f5
4 changes: 2 additions & 2 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ public function copy($source, $target, $preserveMtime = false) {

try {
$exists = $this->file_exists($target);
if ($this->shouldEmitHooks()) {
if ($this->shouldEmitHooks($target)) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_copy,
Expand Down Expand Up @@ -978,7 +978,7 @@ public function copy($source, $target, $preserveMtime = false) {
$this->changeLock($target, ILockingProvider::LOCK_SHARED);
$lockTypePath2 = ILockingProvider::LOCK_SHARED;

if ($this->shouldEmitHooks() && $result !== false) {
if ($this->shouldEmitHooks($target) && $result !== false) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_copy,
Expand Down