log failures to read certificates during listing

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2023-05-25 17:03:18 +02:00 committed by backportbot-nextcloud[bot]
parent f82f5d05c3
commit 5fde58d4f0

View file

@ -92,8 +92,14 @@ class CertificateManager implements ICertificateManager {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
try {
$result[] = new Certificate($this->view->file_get_contents($path . $file), $file);
$content = $this->view->file_get_contents($path . $file);
if ($content !== false) {
$result[] = new Certificate($content, $file);
} else {
$this->logger->error("Failed to read certificate from $path");
}
} catch (\Exception $e) {
$this->logger->error("Failed to read certificate from $path", ['exception' => $e]);
}
}
}