Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/packages/pkginfo.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-07 15:25:36 +0100
committerErich Eckner <git@eckner.net>2019-02-07 15:25:36 +0100
commitbffc28e4bf5cfeae4a84746b2794682acf17e187 (patch)
tree36e3b8f14dd7fff5ef031bd39e28b6ec738d855b /packages/pkginfo.php
parent99e6e4b641ad2214c6fe7e7d2484c9d64a1d83b6 (diff)
packages/pkginfo.php: check for missing arguments
Diffstat (limited to 'packages/pkginfo.php')
-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(