fix bug that caused urls with quoted spaces to not work https://i.imgur.com/RFyI9jB.png

master
Aevann 2023-06-26 18:28:07 +03:00
parent aacffe0d1c
commit 5b86ee21b0
2 changed files with 3 additions and 2 deletions

View File

@ -660,7 +660,6 @@ def normalize_url(url):
url = imgur_regex.sub(r'\1_d.webp?maxwidth=9999&fidelity=grand', url) url = imgur_regex.sub(r'\1_d.webp?maxwidth=9999&fidelity=grand', url)
url = giphy_regex.sub(r'\1.webp', url) url = giphy_regex.sub(r'\1.webp', url)
url = unquote(url)
return url return url

View File

@ -5,7 +5,7 @@ from io import BytesIO
from os import path from os import path
from shutil import copyfile from shutil import copyfile
from sys import stdout from sys import stdout
from urllib.parse import ParseResult, urlparse, urlunparse from urllib.parse import ParseResult, urlparse, urlunparse, unquote
import gevent import gevent
import requests import requests
@ -407,6 +407,7 @@ def is_repost(v):
if not url or len(url) < MIN_REPOST_CHECK_URL_LENGTH: abort(400) if not url or len(url) < MIN_REPOST_CHECK_URL_LENGTH: abort(400)
url = normalize_url(url) url = normalize_url(url)
url = unquote(url)
parsed_url = urlparse(url) parsed_url = urlparse(url)
domain = parsed_url.netloc domain = parsed_url.netloc
@ -496,6 +497,7 @@ def submit_post(v:User, sub=None):
if url: if url:
url = normalize_url(url) url = normalize_url(url)
url = unquote(url)
parsed_url = urlparse(url) parsed_url = urlparse(url)
domain = parsed_url.netloc domain = parsed_url.netloc