Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of links: only external links should open in a new tab #380

Merged
merged 1 commit into from
Aug 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down