Fix split package error handling

Do not remove parentheses from the pkgname to make sure the split
package detection works properly.

Also, fix a regression introduced in 4bb6e88 (pkgsubmit.php: Simplify
package name validation, 2013-03-05) that resulted in the split package
error message never showing up.

Fixes FS#37496.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-01-11 13:31:21 +01:00
parent d8ea2d4a02
commit f2e26ebbf8

View file

@ -180,10 +180,12 @@ if ($uid):
} }
if (!empty($lparts)) { if (!empty($lparts)) {
# this is a variable/value pair, strip out # this is a variable/value pair, strip
# array parens and any quoting, except in pkgdesc # out array parens and any quoting,
# for pkgdesc, only remove start/end pairs of " or ' # except in pkgdesc for pkgname or
if ($lparts[0]=="pkgdesc") { # pkgdesc, only remove start/end pairs
# of " or '
if ($lparts[0] == "pkgname" || $lparts[0] == "pkgdesc") {
if ($lparts[1]{0} == '"' && if ($lparts[1]{0} == '"' &&
$lparts[1]{strlen($lparts[1])-1} == '"') { $lparts[1]{strlen($lparts[1])-1} == '"') {
$pkgbuild[$lparts[0]] = substr($lparts[1], 1, -1); $pkgbuild[$lparts[0]] = substr($lparts[1], 1, -1);
@ -286,8 +288,7 @@ if ($uid):
$pkg_name = $new_pkgbuild['pkgname']; $pkg_name = $new_pkgbuild['pkgname'];
if ($pkg_name[0] == '(') { if ($pkg_name[0] == '(') {
$error = __("Error - The AUR does not support split packages!"); $error = __("Error - The AUR does not support split packages!");
} } elseif (!preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/", $pkg_name)) {
if (!preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/", $pkg_name)) {
$error = __("Invalid name: only lowercase letters are allowed."); $error = __("Invalid name: only lowercase letters are allowed.");
} }
} }