summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-07-06 10:39:02 +0200
committerGitHub <noreply@github.com>2020-07-06 10:39:02 +0200
commit45133424782f6fe8af35c808c0da6c4051e16cce (patch)
tree06ab9fc0ec8f205f100a154b36ded5a9c2563d49
parentf1b1e1ddb223f507d3a545bdca71decb64670f29 (diff)
parent905fab3356a6a0ac355c7cb829b63cdc257d67b4 (diff)
downloadnextcloud-server-45133424782f6fe8af35c808c0da6c4051e16cce.tar.gz
nextcloud-server-45133424782f6fe8af35c808c0da6c4051e16cce.zip
Merge pull request #21671 from nextcloud/revert-21095-backport/21090/stable19
Revert "[stable19] Do not read certificate bundle from data dir by default"
-rw-r--r--lib/private/Http/Client/Client.php14
-rw-r--r--tests/lib/Http/Client/ClientTest.php5
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php
index c0b05c48b96..d19f1124a23 100644
--- a/lib/private/Http/Client/Client.php
+++ b/lib/private/Http/Client/Client.php
@@ -93,18 +93,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 bd9cab023f5..b136a0ca300 100644
--- a/tests/lib/Http/Client/ClientTest.php
+++ b/tests/lib/Http/Client/ClientTest.php
@@ -460,8 +460,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',