]> source.dussan.org Git - nextcloud-server.git/commitdiff
- remove leading http[s] to let createBaseUri() generate secure/unsecure base URI
authorBjoern Schiessle <schiessle@owncloud.com>
Fri, 29 Jun 2012 09:59:47 +0000 (11:59 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Fri, 29 Jun 2012 10:01:23 +0000 (12:01 +0200)
- if secure is set to true add 's' to http

apps/files_external/lib/webdav.php

index d136f04f3eb5e7f90ea5bd7c2ffbbc761b0ee256..94d9abb6a253e2d76108ce025cf911fd6e9c8d9a 100644 (file)
@@ -20,10 +20,14 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
        private static $tempFiles=array();
        
        public function __construct($params){
-               $this->host=$params['host'];
+               $host = $params['host'];
+               //remove leading http[s], will be generated in createBaseUri()
+               if (substr($host,0,8) == "https://") $host = substr($host, 8);
+               else if (substr($host,0,7) == "http://") $host = substr($host, 7);
+               $this->host=$host;
                $this->user=$params['user'];
                $this->password=$params['password'];
-               $this->secure=isset($params['secure'])?(bool)$params['secure']:false;
+               $this->secure=(isset($params['secure']) && $params['secure'] == 'true')?true:false;
                $this->root=isset($params['root'])?$params['root']:'/';
                if(!$this->root || $this->root[0]!='/'){
                        $this->root='/'.$this->root;
@@ -46,7 +50,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
        private function createBaseUri(){
                $baseUri='http';
                if($this->secure){
-                       $baseUri.'s';
+                       $baseUri.='s';
                }
                $baseUri.='://'.$this->host.$this->root;
                return $baseUri;