Skip to content

Commit

Permalink
Fix image links not being opened in new tab (#790)
Browse files Browse the repository at this point in the history
The majority of image links and links that are not handle by whoogle are not
opening in new tabs, this allow links that are not related to the application
to open in new tabs.
  • Loading branch information
jacr13 committed Jun 24, 2022
1 parent 194b2ea commit ddb8931
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,6 @@ def update_link(self, link: Tag) -> None:
self._av.add(netloc)
append_anon_view(link, self.config)

if self.config.new_tab:
link['target'] = '_blank'
else:
if href.startswith(MAPS_URL):
# Maps links don't work if a site filter is applied
Expand All @@ -482,6 +480,12 @@ def update_link(self, link: Tag) -> None:
else:
link['href'] = href

if self.config.new_tab and (
link["href"].startswith("http")
or link["href"].startswith("imgres?")
):
link["target"] = "_blank"

# Replace link location if "alts" config is enabled
if self.config.alts:
# Search and replace all link descriptions
Expand Down

0 comments on commit ddb8931

Please sign in to comment.