diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2012-06-29 11:59:47 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2012-06-29 12:01:23 +0200 |
commit | 60ec46f706fde158ec66b447446ed0b763e40076 (patch) | |
tree | 2af08980dfa5fdd8bd4ff5693ad4983bb6b4e854 | |
parent | bd908affa3972653c99e4a9f7f0bc846d81e0b16 (diff) | |
download | nextcloud-server-60ec46f706fde158ec66b447446ed0b763e40076.tar.gz nextcloud-server-60ec46f706fde158ec66b447446ed0b763e40076.zip |
- remove leading http[s] to let createBaseUri() generate secure/unsecure base URI
- if secure is set to true add 's' to http
-rw-r--r-- | apps/files_external/lib/webdav.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index d136f04f3eb..94d9abb6a25 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -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; |