aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorJonas <jonas@freesources.org>2025-05-20 17:14:05 +0200
committerJonas <jonas@freesources.org>2025-05-27 12:14:14 +0200
commitc952570e6700906cbed71a7036e68211b38936f5 (patch)
tree3801ebb97fe4e699eae7899abec00e1ed532f921 /lib/private/Files
parentbb795239b529c67c50eafa65d416b0acf63a0890 (diff)
downloadnextcloud-server-c952570e6700906cbed71a7036e68211b38936f5.tar.gz
nextcloud-server-c952570e6700906cbed71a7036e68211b38936f5.zip
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 <jonas@freesources.org>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/View.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 6832b4e1551..63eecf5e1d6 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -938,7 +938,7 @@ class View {
try {
$exists = $this->file_exists($target);
- if ($this->shouldEmitHooks()) {
+ if ($this->shouldEmitHooks($target)) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_copy,
@@ -978,7 +978,7 @@ class View {
$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,