Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
only use nextcloud bundle when explicitly enabled
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and backportbot-nextcloud[bot] committed Jul 18, 2022
commit 178f65ab93410eb30815685ee10aed77025f38b7
23 changes: 14 additions & 9 deletions lib/private/Files/ObjectStore/S3ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OC\Files\ObjectStore;

use Aws\ClientResolver;
Expand Down Expand Up @@ -144,7 +145,7 @@ public function getConnection() {
if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
$logger = \OC::$server->getLogger();
$logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.',
['app' => 'objectstore']);
['app' => 'objectstore']);
}

if ($this->params['verify_bucket_exists'] && !$this->connection->doesBucketExist($this->bucket)) {
Expand Down Expand Up @@ -196,7 +197,7 @@ public static function legacySignatureProvider($version, $service, $region) {
/**
* This function creates a credential provider based on user parameter file
*/
protected function paramCredentialProvider() : callable {
protected function paramCredentialProvider(): callable {
return function () {
$key = empty($this->params['key']) ? null : $this->params['key'];
$secret = empty($this->params['secret']) ? null : $this->params['secret'];
Expand All @@ -212,14 +213,18 @@ protected function paramCredentialProvider() : callable {
};
}

protected function getCertificateBundlePath(): string {
// since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
if (!isset($this->params['primary_storage'])) {
/** @var ICertificateManager $certManager */
$certManager = \OC::$server->get(ICertificateManager::class);
return $certManager->getAbsoluteBundlePath();
protected function getCertificateBundlePath(): ?string {
if ((int)($this->params['use_nextcloud_bundle'] ?? "0")) {
// since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
if (!isset($this->params['primary_storage'])) {
/** @var ICertificateManager $certManager */
$certManager = \OC::$server->get(ICertificateManager::class);
return $certManager->getAbsoluteBundlePath();
} else {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
} else {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
return null;
}
}
}
2 changes: 1 addition & 1 deletion lib/private/Files/ObjectStore/S3ObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ trait S3ObjectTrait {
*/
abstract protected function getConnection();

abstract protected function getCertificateBundlePath(): string;
abstract protected function getCertificateBundlePath(): ?string;

/**
* @param string $urn the unified resource name used to identify the object
Expand Down