MDL-37014 repository_webdav - strip the server URL from file & folder paths returned...
authorDavo Smith <git@davosmith.co.uk>
Wed, 5 Dec 2012 14:05:24 +0000 (14:05 +0000)
committerDavo Smith <git@davosmith.co.uk>
Wed, 12 Dec 2012 08:36:34 +0000 (08:36 +0000)
repository/webdav/lib.php

index aa35dfe..52ed0a8 100644 (file)
@@ -124,6 +124,9 @@ class repository_webdav extends repository {
                 $v['lastmodified'] = null;
             }
 
+            // Remove the server URL from the path (if present), otherwise links will not work - MDL-37014
+            $server = preg_quote($this->options['webdav_server']);
+            $v['href'] = preg_replace("#https?://{$server}#", '', $v['href']);
             // Extracting object title from absolute path
             $v['href'] = substr(urldecode($v['href']), strlen($webdavpath));
             $title = substr($v['href'], strlen($path));