diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index 0dde56b28f969..2cf5332d0c683 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -93,18 +93,18 @@ private function getRequestOptions() { } private function getCertBundle() { - if ($this->certificateManager->listCertificates() !== []) { - return $this->certificateManager->getAbsoluteBundlePath(); - } else { - // 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); - } else { - return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; - } + // 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) === false) { + return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; } + + if ($this->certificateManager->listCertificates() === []) { + 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 ea825266198f7..54d6cc465a9a0 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -260,9 +260,8 @@ public function testSetDefaultOptionsWithNotInstalled() { ->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',