Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Do not read certificate bundle from data dir by default" #24556

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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