summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2015-02-24 23:06:47 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-27 12:31:20 +0000
commit1c5a86a115e555e3bc1ea133d6911f897bbe7a53 (patch)
tree7d57e80a14831bb6813f201bdc952c636ad37320
parent57d6c49a6299faad36d1446fddbf17386c07b0aa (diff)
downloadnextcloud-server-1c5a86a115e555e3bc1ea133d6911f897bbe7a53.tar.gz
nextcloud-server-1c5a86a115e555e3bc1ea133d6911f897bbe7a53.zip
Fix bugs in ownCloud external storage
-rw-r--r--apps/files_external/lib/owncloud.php4
-rw-r--r--apps/files_external/tests/owncloudfunctions.php8
2 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_external/lib/owncloud.php b/apps/files_external/lib/owncloud.php
index 04a1e959eb0..7d452e8ff4d 100644
--- a/apps/files_external/lib/owncloud.php
+++ b/apps/files_external/lib/owncloud.php
@@ -37,13 +37,13 @@ class OwnCloud extends \OC\Files\Storage\DAV{
$host = substr($host, 0, $hostSlashPos);
}
- if (substr($contextPath , 1) !== '/'){
+ if (substr($contextPath, -1) !== '/'){
$contextPath .= '/';
}
if (isset($params['root'])){
$root = $params['root'];
- if (substr($root, 1) !== '/'){
+ if (substr($root, 0, 1) !== '/'){
$root = '/' . $root;
}
}
diff --git a/apps/files_external/tests/owncloudfunctions.php b/apps/files_external/tests/owncloudfunctions.php
index 57608fff0cf..deb501a57a0 100644
--- a/apps/files_external/tests/owncloudfunctions.php
+++ b/apps/files_external/tests/owncloudfunctions.php
@@ -68,6 +68,14 @@ class OwnCloudFunctions extends \PHPUnit_Framework_TestCase {
),
'http://testhost/testroot/remote.php/webdav/subdir/',
),
+ array(
+ array(
+ 'host' => 'http://testhost/testroot/',
+ 'root' => '/subdir',
+ 'secure' => false
+ ),
+ 'http://testhost/testroot/remote.php/webdav/subdir/',
+ ),
);
}