mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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:
parent
6790b36247
commit
f2301ca922
2 changed files with 2 additions and 1 deletions
|
@ -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()) {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue