From ca9e2d8e434dea2113bb2d8773d7074f1b63f5c3 Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Sun, 8 Mar 2009 15:58:38 +0100 Subject: [PATCH] Fix for windows issues (hopefully) Now converting all \ in path names to / prior to further handling. That should make sure that pathnames in jailcheck actually match. --- syntax.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/syntax.php b/syntax.php index ff48e86..e2ac004 100644 --- a/syntax.php +++ b/syntax.php @@ -279,7 +279,7 @@ class syntax_plugin_filelist extends DokuWiki_Syntax_Plugin { $pattern = DOKU_INC.$pattern; } // get the canonicalized basedir (without resolving symlinks) - $dir = rp(dirname($pattern)).'/'; + $dir = $this->_win_path_convert(rp(dirname($pattern)).'/'); // if the directory is non existant, we of course have no matches if (!$dir || !file_exists($dir)) @@ -291,8 +291,9 @@ class syntax_plugin_filelist extends DokuWiki_Syntax_Plugin { $webdir = false; if (count($allowed_absolute_paths) == count($web_paths)) { for($i = 0; $i < count($allowed_absolute_paths); $i++) { - if (strstr($dir, trim($allowed_absolute_paths[$i])) == $dir) { - $basedir = trim($allowed_absolute_paths[$i]); + $abs_path = $this->_win_path_convert(trim($allowed_absolute_paths[$i])); + if (strstr($dir, $abs_path) == $dir) { + $basedir = $abs_path; $webdir = trim($web_paths[$i]); break; } @@ -357,6 +358,10 @@ class syntax_plugin_filelist extends DokuWiki_Syntax_Plugin { else return DOKU_PLUGIN_FILELIST_NOMATCH; } + + function _win_path_convert($path) { + return str_replace('\\', '/', trim($path)); + } } /**