Skip to content

Commit 24e97c1

Browse files
authored
Merge pull request #21095 from nextcloud/backport/21090/stable19
[stable19] Do not read certificate bundle from data dir by default
2 parents 3bf0285 + ebbdd2d commit 24e97c1

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

lib/private/Http/Client/Client.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ private function buildRequestOptions(array $options): array {
9393
}
9494

9595
private function getCertBundle(): string {
96-
if ($this->certificateManager->listCertificates() !== []) {
97-
return $this->certificateManager->getAbsoluteBundlePath();
98-
}
99-
10096
// If the instance is not yet setup we need to use the static path as
10197
// $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate
10298
// a view
103-
if ($this->config->getSystemValue('installed', false)) {
104-
return $this->certificateManager->getAbsoluteBundlePath(null);
99+
if ($this->config->getSystemValue('installed', false) === false) {
100+
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
101+
}
102+
103+
if ($this->certificateManager->listCertificates() === []) {
104+
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
105105
}
106106

107-
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
107+
return $this->certificateManager->getAbsoluteBundlePath();
108108
}
109109

110110
/**

tests/lib/Http/Client/ClientTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,8 @@ public function testSetDefaultOptionsWithNotInstalled(): void {
460460
->with('installed', false)
461461
->willReturn(false);
462462
$this->certificateManager
463-
->expects($this->once())
464-
->method('listCertificates')
465-
->willReturn([]);
463+
->expects($this->never())
464+
->method('listCertificates');
466465

467466
$this->assertEquals([
468467
'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt',

0 commit comments

Comments
 (0)