From 48ae53263a53940e391672e52afa054d24e1fa35 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 28 Feb 2022 00:10:39 +0200 Subject: [PATCH] gallery --- files/helpers/sanitize.py | 2 +- files/routes/posts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index dccdc314a..fb1919667 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -289,7 +289,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]: sanitized = sanitized.replace(rd, "://old.reddit.com") - sanitized = sanitized.replace("old.reddit.com/gallery", "new.reddit.com/gallery") + sanitized = sanitized.replace("old.reddit.com/gallery", "reddit.com/gallery") sanitized = re.sub(' (https:\/\/[^ <>]*)', r' \1', sanitized, flags=re.A) sanitized = re.sub('

(https:\/\/[^ <>]*)', r'

\1

', sanitized, flags=re.A) diff --git a/files/routes/posts.py b/files/routes/posts.py index b6d6b04be..fac26e13f 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -891,7 +891,7 @@ def submit_post(v, sub=None): for rd in ("://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it", "://teddit.net"): url = url.replace(rd, "://old.reddit.com") - url = url.replace("nitter.net", "twitter.com").replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") + url = url.replace("nitter.net", "twitter.com").replace("old.reddit.com/gallery", "reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/")