]> source.dussan.org Git - nextcloud-server.git/commitdiff
[BUGFIX] check return value and improve error handling
authorJan Messer <jan@mtec-studios.ch>
Fri, 11 Nov 2022 01:52:32 +0000 (02:52 +0100)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Thu, 4 May 2023 20:02:34 +0000 (20:02 +0000)
With S3 primary storage there was a problem with getting the CA bundle from the storage without having the CA bundle for the connection which causes that the CertificateManager was throwing an Error.
This commit improves the handling in CertificateManager and log unexpected behaviors.

Signed-off-by: Jan Messer <jan@mtec-studios.ch>
lib/private/Security/CertificateManager.php

index fa26c19ceae8461e27f2eb46a09f64d8960a256c..f1107130887cb83a58ba6d575eca8ddcdd8ab2b2 100644 (file)
@@ -238,7 +238,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';
                                }
@@ -251,6 +251,7 @@ class CertificateManager implements ICertificateManager {
                        }
                        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';
                }
        }