diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-07-03 14:21:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 14:21:28 +0200 |
commit | f3cb2a82089fcb82ee328e19e84e92b22287bde6 (patch) | |
tree | f1f9072d7b9d970042acfffe03fc54b11c46b0ad | |
parent | 68fdcc03bfa5058d59773cbe006c60bc5b9fec01 (diff) | |
download | nextcloud-server-f3cb2a82089fcb82ee328e19e84e92b22287bde6.tar.gz nextcloud-server-f3cb2a82089fcb82ee328e19e84e92b22287bde6.zip |
Revert "[stable18] Do not read certificate bundle from data dir by default"
-rw-r--r-- | lib/private/Http/Client/Client.php | 14 | ||||
-rw-r--r-- | tests/lib/Http/Client/ClientTest.php | 5 |
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index 3e606caae19..c52d90ff8ec 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -81,18 +81,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) === false) { - return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; - } - - if ($this->certificateManager->listCertificates() === []) { - return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; + if ($this->config->getSystemValue('installed', false)) { + return $this->certificateManager->getAbsoluteBundlePath(null); } - return $this->certificateManager->getAbsoluteBundlePath(); + return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; } /** diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php index a9ab7d6046b..2a7bd6a185d 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -262,8 +262,9 @@ class ClientTest extends \Test\TestCase { ->with('installed', false) ->willReturn(false); $this->certificateManager - ->expects($this->never()) - ->method('listCertificates'); + ->expects($this->once()) + ->method('listCertificates') + ->willReturn([]); $this->assertEquals([ 'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt', |