git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 338df7e3 authored by mmn's avatar mmn

Fix Nickname::isSystemPath() work properly for routes

parent c8753353
......@@ -180,18 +180,18 @@ class Nickname
// All directory and file names in site root should be blacklisted
$d = dir(INSTALLDIR);
while (false !== ($entry = $d->read())) {
$paths[] = $entry;
$paths[$entry] = true;
}
$d->close();
// All top level names in the router should be blacklisted
$router = Router::get();
foreach (array_keys($router->m->getPaths()) as $path) {
if (preg_match('/^\/(.*?)[\/\?]/',$path,$matches)) {
$paths[] = $matches[1];
foreach ($router->m->getPaths() as $path) {
if (preg_match('/^([^\/\?]+)[\/\?]/',$path,$matches) && isset($matches[1])) {
$paths[$matches[1]] = true;
}
}
return in_array($str, $paths);
return in_array($str, array_keys($paths));
}
/**
......
......@@ -66,7 +66,7 @@ class URLMapper
throw new Exception(sprintf("Can't connect %s; path has no action.", $path));
}
$allpaths[] = $path;
$this->allpaths[] = $path;
$action = $args[self::ACTION];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment