diff options
author | Joas Schilling <coding@schilljs.com> | 2023-11-09 15:57:22 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-11-09 15:57:22 +0100 |
commit | 67958915da26eade597b1fcb3764f5c793fa27e1 (patch) | |
tree | 9562ca0b866d703ab7051d16c73182a3148f4ac1 /lib/private/Files | |
parent | a08281cc5d60d913beba9ac8c01ee8e94489bc21 (diff) | |
download | nextcloud-server-67958915da26eade597b1fcb3764f5c793fa27e1.tar.gz nextcloud-server-67958915da26eade597b1fcb3764f5c793fa27e1.zip |
fix(events): Make sure all `\OCP\Files::…` events are emitted with the same data
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Node/Node.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 1fdedd844ae..acd91c56d3f 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -132,7 +132,14 @@ class Node implements INode { if (method_exists($this->root, 'emit')) { $this->root->emit('\OC\Files', $hook, $args); } - $dispatcher->dispatch('\OCP\Files::' . $hook, new GenericEvent($args)); + + if (in_array($hook, ['preWrite', 'postWrite', 'preCreate', 'postCreate', 'preTouch', 'postTouch', 'preDelete', 'postDelete'], true)) { + $event = new GenericEvent($args[0]); + } else { + $event = new GenericEvent($args); + } + + $dispatcher->dispatch('\OCP\Files::' . $hook, $event); } } |