diff options
-rw-r--r-- | lib/private/Http/Client/Client.php | 14 | ||||
-rw-r--r-- | tests/lib/Http/Client/ClientTest.php | 5 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index 28694f38585..0753c932ac5 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -76,18 +76,18 @@ class Client implements IClient { } private function getCertBundle(): string { - if ($this->certificateManager->listCertificates() !== []) { - return $this->certificateManager->getAbsoluteBundlePath(); - } - // If the instance is not yet setup we need to use the static path as // $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate // a view - if ($this->config->getSystemValue('installed', false)) { - return $this->certificateManager->getAbsoluteBundlePath(null); + if ($this->config->getSystemValue('installed', false) === false) { + return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; + } + + if ($this->certificateManager->listCertificates() === []) { + return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; } - return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; + return $this->certificateManager->getAbsoluteBundlePath(); } /** diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php index 5c0693732bc..da96748f067 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -262,9 +262,8 @@ class ClientTest extends \Test\TestCase { ->with('installed', false) ->willReturn(false); $this->certificateManager - ->expects($this->once()) - ->method('listCertificates') - ->willReturn([]); + ->expects($this->never()) + ->method('listCertificates'); $this->assertEquals([ 'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt', |