]> source.dussan.org Git - nextcloud-server.git/commitdiff
Revert "[stable18] Do not read certificate bundle from data dir by default" 21670/head
authorRoeland Jago Douma <rullzer@users.noreply.github.com>
Fri, 3 Jul 2020 12:21:28 +0000 (14:21 +0200)
committerGitHub <noreply@github.com>
Fri, 3 Jul 2020 12:21:28 +0000 (14:21 +0200)
lib/private/Http/Client/Client.php
tests/lib/Http/Client/ClientTest.php

index 3e606caae1979b896dd5d12d6876605b48e915e6..c52d90ff8ecd81379381a1acb8ecc4a001bb5ecf 100644 (file)
@@ -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';
        }
 
        /**
index a9ab7d6046bafe100a1799db05c8eb0d80c01ccd..2a7bd6a185d5dca018674b57e044e8d3655769ea 100644 (file)
@@ -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',