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.
This commit is contained in:
11
syntax.php
11
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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user