Skip to content

Commit

Permalink
Merge pull request #1274 from nextcloud/fix/log-errors
Browse files Browse the repository at this point in the history
fix: Avoid variable access on unhandled exception and lower log level for expected permission check failures
  • Loading branch information
juliusknorr authored Aug 5, 2024
2 parents 0123c60 + b174d50 commit a4fba06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Service/PermissionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ private function checkPermission(Table|View|Context $element, string $nodeType,
}
} catch (NotFoundError $e) {
}
$this->logger->error($e->getMessage(), ['exception' => $e]);
$this->logger->info($e->getMessage(), ['exception' => $e]);
}

return false;
Expand All @@ -580,7 +580,7 @@ private function checkPermissionById(int $elementId, string $nodeType, string $p
}
} catch (NotFoundError $e) {
}
$this->logger->error($e->getMessage(), ['exception' => $e]);
$this->logger->info($e->getMessage(), ['exception' => $e]);
}
}
return false;
Expand Down
7 changes: 3 additions & 4 deletions lib/Service/ViewService.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,9 @@ private function enhanceView(View $view, string $userId): void {
$manageTableShare = $this->shareService->getSharedPermissionsIfSharedWithMe($view->getTableId(), 'table', $userId);
} catch (NotFoundError) {
$manageTableShare = $this->permissionsService->getPermissionArrayForNodeFromContexts($view->getTableId(), 'table', $userId);
} finally {
if ($manageTableShare->manage) {
$permissions->manageTable = true;
}
}
if ($manageTableShare->manage) {
$permissions->manageTable = true;
}
} catch (NotFoundError $e) {
} catch (\Exception $e) {
Expand Down

0 comments on commit a4fba06

Please sign in to comment.