]> 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>
Fri, 27 Mar 2015 12:31:20 +0000 (12:31 +0000)
apps/files_external/lib/owncloud.php
apps/files_external/tests/owncloudfunctions.php

index 04a1e959eb019bbb49d596e711fa5be7b5c0f155..7d452e8ff4de4dcd078a96043d24a89ce1c4f8b2 100644 (file)
@@ -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;
                        }
                }
index 57608fff0cf68ebdaec542d0b10982ba8a71f9c4..deb501a57a0f28f5b9d1d9bdb0e7ca46db4dcf4f 100644 (file)
@@ -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/',
+                       ),
                );
        }