Skip to content

Commit

Permalink
Merge pull request #24556 from nextcloud/revert/stable20/21090
Browse files Browse the repository at this point in the history
Revert "Do not read certificate bundle from data dir by default"
  • Loading branch information
rullzer authored Dec 4, 2020
2 parents a53871f + b1e9752 commit c7cb8eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions lib/private/Http/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ private function buildRequestOptions(array $options): array {
}

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 instantiate
// 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';
}

/**
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/Http/Client/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,9 @@ public function testSetDefaultOptionsWithNotInstalled(): void {
->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',
Expand Down

0 comments on commit c7cb8eb

Please sign in to comment.