summaryrefslogtreecommitdiff
path: root/service/app
diff options
context:
space:
mode:
authorBruno Wagner Goncalves <bwagner@thoughtworks.com>2014-08-07 16:23:40 -0300
committerBruno Wagner Goncalves <bwagner@thoughtworks.com>2014-08-07 16:23:40 -0300
commit719240d19bfcf5488a99d38cacccdbbeb94e30f8 (patch)
treee5483ac61d4de59d092092e221befb3ba816b56a /service/app
parent579dafc737ef4a3af98cede0af72bb492ca8a944 (diff)
#2 - +@shyba +@bwagner +@neissi - fixed search with quotes bug
Diffstat (limited to 'service/app')
-rw-r--r--service/app/search/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/service/app/search/__init__.py b/service/app/search/__init__.py
index 22f4795b..c89ae704 100644
--- a/service/app/search/__init__.py
+++ b/service/app/search/__init__.py
@@ -1,4 +1,5 @@
from scanner import StringScanner, StringRegexp
+import re
def _next_token():
@@ -23,8 +24,8 @@ class SearchQuery:
@staticmethod
def compile(query):
compiled = {"tags": [], "not_tags": []}
-
- scanner = StringScanner(query.encode('utf8').replace("\"", ""))
+ sanitized_query = re.sub(r"['\"]", "", query.encode('utf8'))
+ scanner = StringScanner(sanitized_query)
first_token = True
while not scanner.is_eos:
token = scanner.scan(_next_token())