remove twitter tracking

pull/98/head
Aevann 2023-01-25 15:54:58 +02:00
parent 90181024cc
commit 2a0e288e12
2 changed files with 3 additions and 0 deletions

View File

@ -23,6 +23,7 @@ description_regex = re.compile("[^<>&\n\t]{1,300}", flags=re.A)
badge_name_regex = re.compile("[A-Za-z0-9 ]+", flags=re.A)
twitter_regex = re.compile("(https:\/\/twitter.com\/[A-Za-z0-9_/]+)\?\S*", flags=re.A)
valid_sub_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$", flags=re.A)

View File

@ -278,6 +278,8 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
sanitized = normalize_url(sanitized)
sanitized = twitter_regex.sub(r'\1', sanitized)
if '```' not in sanitized and '<pre>' not in sanitized:
sanitized = linefeeds_regex.sub(r'\1\n\n\2', sanitized)