diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index ecc6f59a0..154c875a8 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -241,10 +241,10 @@ def sanitize(sanitized, noimages=False): for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: sanitized = sanitized.replace(rd, "https://old.reddit.com/") - for i in re.finditer('[^">](https:\/\/[^ ]*)', sanitized): - sanitized = sanitized.replace(i.group(1), f"") + for i in re.finditer('[^">](https:\/\/.*?)( |<)', sanitized): + sanitized = sanitized.replace(i.group(1), f"{i.group(1)}") for i in re.finditer('

(https:\/\/[^ ]*)', sanitized): - sanitized = sanitized.replace(i.group(1), f"") + sanitized = sanitized.replace(i.group(1), f"{i.group(1)}") return sanitized