Merge pull request #47252 from nextcloud/bugfix/noid/dont-crash-when-creating-folder

fix(adminaudit): Don't crash when creating folder
This commit is contained in:
Joas Schilling 2024-08-15 15:33:49 +02:00 committed by GitHub
commit 15550de8ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -159,10 +159,11 @@ class Files extends Action {
* @param BeforeNodeWrittenEvent $event
*/
public function write(BeforeNodeWrittenEvent $event): void {
$node = $event->getNode();
try {
$params = [
'id' => $event->getNode()->getId(),
'path' => mb_substr($event->getNode()->getInternalPath(), 5),
'id' => $node instanceof NonExistingFile ? null : $node->getId(),
'path' => mb_substr($node->getInternalPath(), 5),
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(