mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
Merge pull request #35092 from Messj1/bugfix/type-error-cert-manager-cache-path
This commit is contained in:
commit
46459ae93f
1 changed files with 12 additions and 5 deletions
|
|
@ -138,6 +138,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();
|
||||
|
|
@ -228,7 +232,7 @@ class CertificateManager implements ICertificateManager {
|
|||
*/
|
||||
public function getAbsoluteBundlePath(): string {
|
||||
try {
|
||||
if (!$this->bundlePath) {
|
||||
if ($this->bundlePath === null) {
|
||||
if (!$this->hasCertificates()) {
|
||||
$this->bundlePath = \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
|
||||
}
|
||||
|
|
@ -237,13 +241,16 @@ class CertificateManager implements ICertificateManager {
|
|||
$this->createCertificateBundle();
|
||||
}
|
||||
|
||||
$this->bundlePath = $this->view->getLocalFile($this->getCertificateBundle()) ?: null;
|
||||
}
|
||||
if ($this->bundlePath === null) {
|
||||
throw new \Exception('Failed to get absolute bundle path');
|
||||
$certificateBundle = $this->getCertificateBundle();
|
||||
$this->bundlePath = $this->view->getLocalFile($certificateBundle) ?: null;
|
||||
|
||||
if ($this->bundlePath === null) {
|
||||
throw new \RuntimeException('Unable to get certificate bundle "' . $certificateBundle . '".');
|
||||
}
|
||||
}
|
||||
return $this->bundlePath;
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Failed to get absolute bundle path. Fallback to default ca-bundle.crt', ['exception' => $e]);
|
||||
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue