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
main
Ben Busby 2023-10-11 11:08:25 -06:00
parent 67b6110087
commit 330ae964f3
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1
1 changed files with 5 additions and 2 deletions

View File

@ -161,8 +161,11 @@ class Filter:
self.update_styling() self.update_styling()
self.remove_block_tabs() self.remove_block_tabs()
for div in self.main_divs: # self.main_divs is only populated for the main page of search results
self.sanitize_div(div) # (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]: for img in [_ for _ in self.soup.find_all('img') if 'src' in _.attrs]:
self.update_element_src(img, 'image/png') self.update_element_src(img, 'image/png')