fix(events): Make sure all `\OCP\Files::…` events are emitted with the same data

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/41365/head
Joas Schilling 3 years ago
parent a08281cc5d
commit 67958915da
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205
  1. 9
      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);
}
}

Loading…
Cancel
Save