From 5189cdb072add9b27aa9de904112a600476ac003 Mon Sep 17 00:00:00 2001 From: DUO Labs Date: Thu, 28 Oct 2021 14:54:27 -0400 Subject: [PATCH] Update "skip bolding" regex to fix some edge cases (#500) Should address errors caused by the "bold query" feature replacing tags and style elements, resulting in unformatted response pages. --- app/utils/results.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/utils/results.py b/app/utils/results.py index c239a28..7b603fb 100644 --- a/app/utils/results.py +++ b/app/utils/results.py @@ -52,7 +52,8 @@ def bold_search_terms(response: str, query: str) -> BeautifulSoup: if len(element) == len(target_word): return - if not target_word.isalnum(): + if not re.match('.*[a-zA-Z0-9].*', target_word) or ( + element.parent and element.parent.name == 'style'): return element.replace_with(