From d60f8662d0b61444bf5700ef71cc367d35d653aa Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 14 May 2023 02:03:34 +0300 Subject: [PATCH] move domain in sanitize() --- files/helpers/sanitize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 5c30cbcc2..fd7fe2603 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -510,7 +510,6 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis= href = link.get("href") if not href: continue - domain = tldextract.extract(href).registered_domain def unlinkfy(): link.string = href @@ -522,6 +521,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis= continue #don't allow something like this https://rdrama.net/post/78376/reminder-of-the-fact-that-our/2150032#context + domain = tldextract.extract(href).registered_domain if domain and not allowed_domain_regex.fullmatch(domain): unlinkfy() continue