From 871f2065c427aaf19a454f399229eb8e764c3a36 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 13 Feb 2013 09:57:13 +1300 Subject: [PATCH] WebDAV::exists() should add a trailing slash for checking dirs Without it, some WebDAV servers will thrown an error. --- code/utils/WebDAV.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/utils/WebDAV.php b/code/utils/WebDAV.php index 98cff3c..268787d 100644 --- a/code/utils/WebDAV.php +++ b/code/utils/WebDAV.php @@ -13,6 +13,11 @@ class WebDAV { } static function exists($url) { + // WebDAV expects that checking a directory exists has a trailing slash + if (substr($url, -1) != '/') { + $url .= '/'; + } + $ch = self::curl_init($url, 'PROPFIND'); $res = curl_exec($ch); @@ -60,4 +65,4 @@ class WebDAV { } -} \ No newline at end of file +}