]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix S3 connection
authorVincent Petry <pvince81@owncloud.com>
Wed, 22 Oct 2014 19:48:22 +0000 (21:48 +0200)
committerVincent Petry <pvince81@owncloud.com>
Wed, 22 Oct 2014 20:17:07 +0000 (22:17 +0200)
apps/files_external/lib/amazons3.php

index da919236f8fd405a8369a99ba295cb6a73762286..22128eb19c0569148740384015bbda2f5232ef08 100644 (file)
@@ -45,6 +45,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
         * @var array
         */
        private static $tmpFiles = array();
+       /**
+        * @var array
+        */
+       private $params;
        /**
         * @var bool
         */
@@ -101,7 +105,6 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                $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'];
@@ -110,7 +113,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                if (!isset($params['port']) || $params['port'] === '') {
                        $params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443;
                }
-               $base_url = $scheme . '://' . $params['hostname'] . ':' . $params['port'] . '/';
+               $this->params = $params;
        }
 
        /**
@@ -549,11 +552,14 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                        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)) {