Only sanitize result content on main result page

The other result tabs (images/maps/videos/news) don't have text content
that needs sanitizing.

Fixes #1080
pull/1085/head
Ben Busby 7 months ago
parent 67b6110087
commit 330ae964f3
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1

@ -161,8 +161,11 @@ class Filter:
self.update_styling()
self.remove_block_tabs()
for div in self.main_divs:
self.sanitize_div(div)
# self.main_divs is only populated for the main page of search results
# (i.e. not images/news/etc).
if self.main_divs:
for div in self.main_divs:
self.sanitize_div(div)
for img in [_ for _ in self.soup.find_all('img') if 'src' in _.attrs]:
self.update_element_src(img, 'image/png')

Loading…
Cancel
Save