changeset 3827:a53e20c3ebab

search: make query parser reject more invalid input
author Johannes Berg <johannes AT sipsolutions DOT net>
date Fri, 11 Jul 2008 13:04:13 +0200
parents 3cbb709f5c5d
children d125f175fc2e 383196922b03
files MoinMoin/search/queryparser.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/queryparser.py	Fri Jul 11 12:56:52 2008 +0200
+++ b/MoinMoin/search/queryparser.py	Fri Jul 11 13:04:13 2008 +0200
@@ -996,7 +996,9 @@
                 domain = False
                 while len(item) > 1:
                     m = item[0]
-                    if m == M:
+                    if m is None:
+                        raise ValueError("Invalid search prefix")
+                    elif m == M:
                         negate = True
                     elif "title".startswith(m):
                         title_search = True
@@ -1014,6 +1016,8 @@
                         mimetype = True
                     elif "domain".startswith(m):
                         domain = True
+                    else:
+                        raise ValueError("Invalid search prefix")
                     item = item[1:]
 
                 text = item[0]