Skip to content

Commit

Permalink
Merge pull request #47071 from nextcloud/fix/no-error-new-file-audit
Browse files Browse the repository at this point in the history
fix(admin_audit): Do not log errors for new files
  • Loading branch information
AndyScherzinger authored Aug 7, 2024
2 parents 72c2b6b + 1c0f02e commit 0050e1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/admin_audit/lib/Actions/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
namespace OCA\AdminAudit\Actions;

use OC\Files\Node\NonExistingFile;
use OCP\Files\Events\Node\BeforeNodeReadEvent;
use OCP\Files\Events\Node\BeforeNodeRenamedEvent;
use OCP\Files\Events\Node\BeforeNodeWrittenEvent;
Expand Down Expand Up @@ -35,9 +36,10 @@ class Files extends Action {
*/
public function read(BeforeNodeReadEvent $event): void {
try {
$node = $event->getNode();
$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(
Expand Down

0 comments on commit 0050e1e

Please sign in to comment.