From db099515f380885f8ddc864099078c110875bc7b Mon Sep 17 00:00:00 2001 From: Laurent le Beau-Martin Date: Fri, 23 Jul 2021 09:23:32 -0400 Subject: [PATCH] Fix handling of links: only external links should open in a new tab --- app/filter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/filter.py b/app/filter.py index 87d00a2c0e..b5fbfbd7c6 100644 --- a/app/filter.py +++ b/app/filter.py @@ -255,8 +255,6 @@ def update_link(self, link: Tag) -> None: # Temporarily removing all links to that tab for now. link.decompose() return - elif self.new_tab: - link['target'] = '_blank' result_link = urlparse.urlparse(href) q = extract_q(result_link.query, href) @@ -286,6 +284,9 @@ def update_link(self, link: Tag) -> None: # Add no-js option if self.nojs: append_nojs(link) + + if self.new_tab: + link['target'] = '_blank' else: if href.startswith(MAPS_URL): # Maps links don't work if a site filter is applied