Эх сурвалжийг харах

HUE-5213 [metadata] Protect against matching terms with regexp syntax in search

Romain Rigaux 9 жил өмнө
parent
commit
a98815a

+ 1 - 0
desktop/libs/metadata/src/metadata/navigator_api.py

@@ -268,6 +268,7 @@ def _augment_highlighting(query_s, records):
 
 
 def _highlight(pattern, string):
+  pattern = re.escape(pattern)
   return re.sub('(%s)' % pattern, '<em>\\1</em>', string, count=1)
 
 

+ 2 - 0
desktop/libs/metadata/src/metadata/navigator_client_tests.py

@@ -79,3 +79,5 @@ class TestNavigatorclient:
 
     # type:table tax
     # owner:romain ca
+
+    # *