routing.inc.php: rtrim() path in get_route()

Return the correct route -- even if a "/" is appended to the URI.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2012-07-17 23:05:47 +02:00
parent 6790b36247
commit f2301ca922
2 changed files with 2 additions and 1 deletions

View file

@ -4,7 +4,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once("aur.inc.php"); include_once("aur.inc.php");
include_once("pkgfuncs.inc.php"); include_once("pkgfuncs.inc.php");
$path = rtrim($_SERVER['PATH_INFO'], '/'); $path = $_SERVER['PATH_INFO'];
$tokens = explode('/', $path); $tokens = explode('/', $path);
if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {

View file

@ -22,6 +22,7 @@ $PKG_PATH = '/packages';
function get_route($path) { function get_route($path) {
global $ROUTES; global $ROUTES;
$path = rtrim($path, '/');
if (isset($ROUTES[$path])) { if (isset($ROUTES[$path])) {
return $ROUTES[$path]; return $ROUTES[$path];
} else { } else {