From ddb8931e683a581c5fd52d094d704aab0189b893 Mon Sep 17 00:00:00 2001 From: "Joao A. Candido Ramos" Date: Fri, 24 Jun 2022 18:50:14 +0200 Subject: [PATCH] Fix image links not being opened in new tab (#790) 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. --- app/filter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/filter.py b/app/filter.py index 630401d..3162c27 100644 --- a/app/filter.py +++ b/app/filter.py @@ -462,8 +462,6 @@ class Filter: 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 @@ -482,6 +480,12 @@ class Filter: 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