Skip to content

Commit 397c969

Browse files
Merge pull request #41365 from nextcloud/bugfix/noid/fix-emitted-events
fix(events): Make sure all `\OCP\Files::…` events are emitted with th…
2 parents 743066a + 6795891 commit 397c969

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/private/Files/Node/Node.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,14 @@ protected function sendHooks($hooks, array $args = null) {
132132
if (method_exists($this->root, 'emit')) {
133133
$this->root->emit('\OC\Files', $hook, $args);
134134
}
135-
$dispatcher->dispatch('\OCP\Files::' . $hook, new GenericEvent($args));
135+
136+
if (in_array($hook, ['preWrite', 'postWrite', 'preCreate', 'postCreate', 'preTouch', 'postTouch', 'preDelete', 'postDelete'], true)) {
137+
$event = new GenericEvent($args[0]);
138+
} else {
139+
$event = new GenericEvent($args);
140+
}
141+
142+
$dispatcher->dispatch('\OCP\Files::' . $hook, $event);
136143
}
137144
}
138145

0 commit comments

Comments
 (0)