Uh oh!
There was an error while loading. Please reload this page.
fix(node): emit hooks on Node::copy() - #52996
Conversation
come-nc
commented
May 20, 2025
@icewind1991 When copying through dav, fakeRoot is set to the files folder, and that matches the default root, and thanks to that the hook is emitted. Do you thing this is the right fix? Do you think we should give the path of source, target, or both? |
b6c76a3 to
bf67d8fComparemejo-
commented
May 26, 2025
/backport to stable31 |
mejo-
commented
May 26, 2025
/backport to stable30 |
e427f00 to
1dd0ec8Compare
artonge
left a comment
There was a problem hiding this comment.
Overall, maybe just look into what the handleMove method is doing, as it seems to be doing something very similar.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1dd0ec8 to
f77ae68CompareWhen 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>
Running $peerFile->copy() causes a second BeforeNodeCopiedEvent now, which we don't want to handle. Signed-off-by: Jonas <jonas@freesources.org>
f77ae68 to
e5b4ae4Compare
When calling
Files\Node\Node::copy(),Files\View::copy()gets called, butFiles\View::fakeRootis empty so the hooks are not emitted if no path is given toFiles\View::shouldEmitHooks().This results in node-related events like
NodeCopiedEventnot being fired when copying files viaFiles\Node\Node::copy().Files\View::shouldEmitHooks()is given a path as parameter in almost all places except when called from thecopy()function. This commit changes it and passes the copy target path.Fixes: nextcloud/collectives#1756
Checklist