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

Enhance User Experience by Opening external UI Links in new Tab on browser. #40635

Merged
merged 12 commits into from
Jul 9, 2024
Prev Previous commit
Next Next commit
ensure that provider links in description open in new browser tab safely
  • Loading branch information
VICIWUOHA committed Jul 8, 2024
commit 54fd5c1fe4a7fd07d98e36de380a61283a2978f7
4 changes: 2 additions & 2 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4514,13 +4514,13 @@ def _build_link(match_obj):
text = match_obj.group(1)
url = match_obj.group(2)

# parsing the url to check if ita a valid url
# parsing the url to check if it's a valid url
parsed_url = urlparse(url)
if not (parsed_url.scheme == "http" or parsed_url.scheme == "https"):
# returning the original raw text
return escape(match_obj.group(0))

return Markup(f'<a href="{url}">{text}</a>')
return Markup(f'<a href="{url}" target="_blank" rel="noopener noreferrer">{text}</a>')

cd = escape(description)
cd = re2.sub(r"`(.*)[\s+]+&lt;(.*)&gt;`__", _build_link, cd)
Expand Down