[BUGFIX] throw exception instead of error if unable to create file handler (only exceptions are catch)

Signed-off-by: Jan Messer <jan@mtec-studios.ch>
This commit is contained in:
Jan Messer 2023-04-04 22:01:35 +02:00 committed by backportbot-nextcloud[bot]
parent c6945666ca
commit 662dcfffd6

View file

@ -147,6 +147,10 @@ class CertificateManager implements ICertificateManager {
$tmpPath = $certPath . '.tmp' . $this->random->generate(10, ISecureRandom::CHAR_DIGITS);
$fhCerts = $this->view->fopen($tmpPath, 'w');
if (!is_resource($fhCerts)) {
throw new \RuntimeException('Unable to open file handler to create certificate bundle "' . $tmpPath . '".');
}
// Write user certificates
foreach ($certs as $cert) {
$file = $path . '/uploads/' . $cert->getName();