summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/pkginfo.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/pkginfo.php b/packages/pkginfo.php
index 7cf1e5d..022f699 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -5,6 +5,17 @@ $uri_prefix = explode('/', $_SERVER['REQUEST_URI']);
$uri_prefix = array_slice($uri_prefix, 0, -4);
$uri_prefix = implode('/', $uri_prefix) . '/';
+if ((!array_key_exists('arch', $_GET) &&
+ !array_key_exists('repo_arch', $_GET)) ||
+ !array_key_exists('repo', $_GET) ||
+ !array_key_exists('pkgname', $_GET))
+ throw_http_error(422, 'Unprocessable Entity');
+
+if (!array_key_exists('repo_arch', $_GET)) {
+ $_GET['repo_arch'] = $_GET['arch'];
+ unset($_GET['arch']);
+}
+
if (($_GET['repo']=='i686') || ($_GET['repo']=='i486') || ($_GET['repo']=='any')) {
header('Location: /' . $_GET['repo'] . '/' . $_GET['repo_arch'] . '/' . $_GET['pkgname'] . '/');
error_log('needed redirect URL: ' . $_SERVER['REQUEST_URI'] . ', HTTP_USER_AGENT: ' . $_SERVER['HTTP_USER_AGENT'] . ', HTTP_REFERER: ' . $_SERVER['HTTP_REFERER']);
@@ -40,11 +51,6 @@ require_once BASE . "/lib/style.php";
else
$skip_json_checks = true;
- if (!array_key_exists("repo_arch",$_GET)) {
- $_GET["repo_arch"] = $_GET["arch"];
- unset($_GET["arch"]);
- }
-
if (!$skip_json_checks) {
$json_content = json_decode(
file_get_contents(