]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix bugs in ownCloud external storage
authorRobin McCorkell <rmccorkell@karoshi.org.uk>
Tue, 24 Feb 2015 23:06:47 +0000 (23:06 +0000)
committerRobin McCorkell <rmccorkell@karoshi.org.uk>
Wed, 25 Feb 2015 10:10:13 +0000 (10:10 +0000)
apps/files_external/lib/owncloud.php
apps/files_external/tests/owncloudfunctions.php

index e9824140c7aed87c3af888f458379abeb91547ea..d00da691cd904150bfc0d5e3d2942219181c21a8 100644 (file)
@@ -49,13 +49,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;
                        }
                }
index de7bf3eff2bd6cf53ad457b108c786802f0e48b1..0135c4618a38e1a03990ca3a1f929df9354e89ea 100644 (file)
@@ -81,6 +81,14 @@ class OwnCloudFunctions extends \Test\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/',
+                       ),
                );
        }