-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(node): emit hooks on Node::copy()
#52996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems logical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
b6c76a3
to
bf67d8f
Compare
/backport to stable31 |
/backport to stable30 |
e427f00
to
1dd0ec8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, maybe just look into what the handleMove
method is doing, as it seems to be doing something very similar.
1dd0ec8
to
f77ae68
Compare
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]>
Running $peerFile->copy() causes a second BeforeNodeCopiedEvent now, which we don't want to handle. Signed-off-by: Jonas <[email protected]>
f77ae68
to
e5b4ae4
Compare
When calling
Files\Node\Node::copy()
,Files\View::copy()
gets called, butFiles\View::fakeRoot
is empty so the hooks are not emitted if no path is given toFiles\View::shouldEmitHooks()
.This results in node-related events like
NodeCopiedEvent
not 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