Ignore merge target for non-merge requests

Message ID 20190524162511.16251-1-lfleischer@archlinux.org
State Accepted, archived
Headers show
Series Ignore merge target for non-merge requests | expand

Commit Message

Lukas Fleischer May 24, 2019, 4:25 p.m. UTC
Fixes FS#59837.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
---
 web/lib/pkgreqfuncs.inc.php | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php
index 774ebe7..b8be7e5 100644
--- a/web/lib/pkgreqfuncs.inc.php
+++ b/web/lib/pkgreqfuncs.inc.php
@@ -127,6 +127,11 @@  function pkgreq_file($ids, $type, $merge_into, $comments) {
 		return array(false, __("You must be logged in to file package requests."));
 	}
 
+	/* Ignore merge target for non-merge requests. */
+	if ($type !== 'merge') {
+		$merge_into = '';
+	}
+
 	if (!empty($merge_into) && !preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/D", $merge_into)) {
 		return array(false, __("Invalid name: only lowercase letters are allowed."));
 	}