Skip to content
Merged
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
28 changes: 17 additions & 11 deletions lib/private/Files/Storage/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
namespace OC\Files\Storage;

use Exception;
use GuzzleHttp\Exception\RequestException;
use OCP\ILogger;
use Psr\Http\Message\ResponseInterface;
use Icewind\Streams\CallbackWrapper;
Expand All @@ -46,6 +45,8 @@
use OCP\Files\FileInfo;
use OCP\Files\StorageInvalidException;
use OCP\Files\StorageNotAvailableException;
use OCP\Http\Client\IClientService;
use OCP\ICertificateManager;
use OCP\Util;
use Sabre\DAV\Client;
use Sabre\DAV\Xml\Property\ResourceType;
Expand Down Expand Up @@ -78,8 +79,10 @@ class DAV extends Common {
protected $client;
/** @var ArrayCache */
protected $statCache;
/** @var \OCP\Http\Client\IClientService */
/** @var IClientService */
protected $httpClientService;
/** @var ICertificateManager */
protected $certManager;

/**
* @param array $params
Expand Down Expand Up @@ -110,13 +113,9 @@ public function __construct($params) {
}
if ($this->secure === true) {
// inject mock for testing
$certManager = \OC::$server->getCertificateManager();
if (is_null($certManager)) { //no user
$certManager = \OC::$server->getCertificateManager(null);
}
$certPath = $certManager->getAbsoluteBundlePath();
if (file_exists($certPath)) {
$this->certPath = $certPath;
$this->certManager = \OC::$server->getCertificateManager();
if (is_null($this->certManager)) { //no user
$this->certManager = \OC::$server->getCertificateManager(null);
}
}
$this->root = $params['root'] ?? '/';
Expand Down Expand Up @@ -149,8 +148,15 @@ protected function init() {

$this->client = new Client($settings);
$this->client->setThrowExceptions(true);
if ($this->secure === true && $this->certPath) {
$this->client->addCurlSetting(CURLOPT_CAINFO, $this->certPath);

if($this->secure === true) {
$certPath = $this->certManager->getAbsoluteBundlePath();
if (file_exists($certPath)) {
$this->certPath = $certPath;
}
if ($this->certPath) {
$this->client->addCurlSetting(CURLOPT_CAINFO, $this->certPath);
}
}
}

Expand Down