Skip to content

Commit

Permalink
Merge pull request #11721 from owncloud/fix-s3-regression
Browse files Browse the repository at this point in the history
[master] Fix S3 connection regression
  • Loading branch information
MorrisJobke committed Oct 23, 2014
2 parents ca01530 + 71dce48 commit 7c14a17
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions apps/files_external/lib/amazons3.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
* @var array
*/
private static $tmpFiles = array();
/**
* @var array
*/
private $params;
/**
* @var bool
*/
Expand Down Expand Up @@ -101,7 +105,6 @@ public function __construct($params) {
$this->updateLegacyId($params);

$this->bucket = $params['bucket'];
$scheme = ($params['use_ssl'] === 'false') ? 'http' : 'https';
$this->test = isset($params['test']);
$this->timeout = (!isset($params['timeout'])) ? 15 : $params['timeout'];
$this->rescanDelay = (!isset($params['rescanDelay'])) ? 10 : $params['rescanDelay'];
Expand All @@ -110,7 +113,7 @@ public function __construct($params) {
if (!isset($params['port']) || $params['port'] === '') {
$params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443;
}
$base_url = $scheme . '://' . $params['hostname'] . ':' . $params['port'] . '/';
$this->params = $params;
}

/**
Expand Down Expand Up @@ -550,11 +553,14 @@ public function getConnection() {
return $this->connection;
}

$scheme = ($this->params['use_ssl'] === 'false') ? 'http' : 'https';
$base_url = $scheme . '://' . $this->params['hostname'] . ':' . $this->params['port'] . '/';

$this->connection = S3Client::factory(array(
'key' => $params['key'],
'secret' => $params['secret'],
'key' => $this->params['key'],
'secret' => $this->params['secret'],
'base_url' => $base_url,
'region' => $params['region']
'region' => $this->params['region']
));

if (!$this->connection->isValidBucketName($this->bucket)) {
Expand Down

0 comments on commit 7c14a17

Please sign in to comment.