Merge branch 'MDL-37014_webdav_folders_23' of git://github.com/davosmith/moodle into...
authorDan Poltawski <dan@moodle.com>
Tue, 18 Dec 2012 06:52:41 +0000 (14:52 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 18 Dec 2012 06:52:41 +0000 (14:52 +0800)
repository/webdav/lib.php

index e467b23..b07135e 100644 (file)
@@ -120,6 +120,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));