diff --git a/core/utils.py b/core/utils.py index ffb1521c22..8f10dd7dd2 100644 --- a/core/utils.py +++ b/core/utils.py @@ -142,18 +142,7 @@ def is_image_url(url: str, **kwargs) -> str: r"\1i.\2.png", url, ) - elif url.startswith("https://imgur.com") or url.startswith("http://imgur.com"): - url = re.sub( - r"(http[s]?:\/\/)((?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)", - r"\1i.\2.jpg", - url, - ) - elif url.startswith("https://tenor.com") or url.startswith("http://tenor.com"): - url = re.sub( - r"(http[s]?:\/\/)((?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)", - r"\1i.\2.gif", - url, - ) + return parse_image_url(url, **kwargs)