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;
|
$pattern = DOKU_INC.$pattern;
|
||||||
}
|
}
|
||||||
// get the canonicalized basedir (without resolving symlinks)
|
// 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 the directory is non existant, we of course have no matches
|
||||||
if (!$dir || !file_exists($dir))
|
if (!$dir || !file_exists($dir))
|
||||||
@@ -291,8 +291,9 @@ class syntax_plugin_filelist extends DokuWiki_Syntax_Plugin {
|
|||||||
$webdir = false;
|
$webdir = false;
|
||||||
if (count($allowed_absolute_paths) == count($web_paths)) {
|
if (count($allowed_absolute_paths) == count($web_paths)) {
|
||||||
for($i = 0; $i < count($allowed_absolute_paths); $i++) {
|
for($i = 0; $i < count($allowed_absolute_paths); $i++) {
|
||||||
if (strstr($dir, trim($allowed_absolute_paths[$i])) == $dir) {
|
$abs_path = $this->_win_path_convert(trim($allowed_absolute_paths[$i]));
|
||||||
$basedir = trim($allowed_absolute_paths[$i]);
|
if (strstr($dir, $abs_path) == $dir) {
|
||||||
|
$basedir = $abs_path;
|
||||||
$webdir = trim($web_paths[$i]);
|
$webdir = trim($web_paths[$i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -357,6 +358,10 @@ class syntax_plugin_filelist extends DokuWiki_Syntax_Plugin {
|
|||||||
else
|
else
|
||||||
return DOKU_PLUGIN_FILELIST_NOMATCH;
|
return DOKU_PLUGIN_FILELIST_NOMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _win_path_convert($path) {
|
||||||
|
return str_replace('\\', '/', trim($path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user