From 832ba29d994b4f6d1d87c74350523c5311b2bcc1 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 8 Jun 2023 08:22:21 +0300 Subject: [PATCH] do this https://rdrama.net/post/176924/oh-my-gosh-you-guys-were/4308538#context --- files/helpers/sanitize.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index a80475ea0..b5aae36b6 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -559,8 +559,10 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis continue #don't allow something like this [https://rԁrama.net/leaderboard](https://iplogger.org/1fRKk7) - if not snappy and tldextract.extract(str(link.string)).registered_domain: - link.string = href + if not snappy: + string_domain = tldextract.extract(str(link.string)).registered_domain + if string_domain and string_domain != tldextract.extract(href).registered_domain: + link.string = href #insert target="_blank" and ref="nofollower noopener" for external link if not href.startswith('/') and not href.startswith(f'{SITE_FULL}/'):