summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-11-09 15:57:22 +0100
committerJoas Schilling <coding@schilljs.com>2023-11-09 15:57:22 +0100
commit67958915da26eade597b1fcb3764f5c793fa27e1 (patch)
tree9562ca0b866d703ab7051d16c73182a3148f4ac1 /lib/private/Files
parenta08281cc5d60d913beba9ac8c01ee8e94489bc21 (diff)
downloadnextcloud-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.php9
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);
}
}