summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-02-28 22:58:22 +0100
committerlpsolit%gmail.com <>2007-02-28 22:58:22 +0100
commite4bb080df93feb9751079a931f10b25cd8f66961 (patch)
treed7f12732cca18518246dddf4c31787ceffb01c46
parent41732933eeb2f25abdd479e5a024cd258c502fd3 (diff)
downloadbugzilla-e4bb080df93feb9751079a931f10b25cd8f66961.tar.gz
bugzilla-e4bb080df93feb9751079a931f10b25cd8f66961.tar.xz
Bug 234226: "Find a specific bug" shouldn't allow empty search - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=justdave
-rwxr-xr-xbuglist.cgi6
-rw-r--r--template/en/default/search/search-specific.html.tmpl8
2 files changed, 12 insertions, 2 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 948916d0f..96011d3f7 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -74,6 +74,12 @@ if (defined($searchstring)) {
# as if this had been a normal query from the beginning.
}
+# Reject empty searches from the simple search form, including
+# words being a single or several consecutive whitespaces only.
+if (defined($cgi->param('content')) && $cgi->param('content') =~ /^\s*$/) {
+ ThrowUserError("buglist_parameters_required");
+}
+
################################################################################
# Data and Security Validation
################################################################################
diff --git a/template/en/default/search/search-specific.html.tmpl b/template/en/default/search/search-specific.html.tmpl
index 2d7eb945d..d93abd883 100644
--- a/template/en/default/search/search-specific.html.tmpl
+++ b/template/en/default/search/search-specific.html.tmpl
@@ -109,8 +109,12 @@ for "crash secure SSL flash".
<tr>
<td></td>
<td>
- <input type="submit" id="search" value="Search">
- </td>
+ <input type="submit" id="search" value="Search"
+ onclick="if (this.form.content.value == '')
+ {alert('The Words field cannot be empty. You have to ' +
+ 'enter at least one word in your search criteria.');
+ return false;} return true;">
+ </td>
</tr>
</table>
</form>