]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 234226: "Find a specific bug" shouldn't allow empty search - Patch by FrédÃ...
authorlpsolit%gmail.com <>
Wed, 28 Feb 2007 22:00:52 +0000 (22:00 +0000)
committerlpsolit%gmail.com <>
Wed, 28 Feb 2007 22:00:52 +0000 (22:00 +0000)
buglist.cgi
template/en/default/search/search-specific.html.tmpl

index 122a917de2f3d363d54cb451708554d7ea019468..a22a7484245f57890b91d800b87f85aad09c5d72 100755 (executable)
@@ -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
 ################################################################################
index 2d7eb945d837bc2c8f29da3bcd7b0aba8abd7e2d..d93abd883bb33efe56821cb4878f6b4ec474f8da 100644 (file)
@@ -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>