fix url normalizing

master
Aevann 2024-11-17 20:21:41 +02:00
parent e620cf635a
commit 2a6600abc5
1 changed files with 2 additions and 3 deletions

View File

@ -34,18 +34,17 @@ from files.__main__ import app, limiter
def _make_post_url(): def _make_post_url():
url = request.values.get("url", "").replace('\x00', '').strip() url = request.values.get("url", "").replace('\x00', '').strip()
if url == '': return None
if '\\' in url: stop(400) if '\\' in url: stop(400)
if len(url) > 2048: if len(url) > 2048:
stop(400, "There's a 2048 character limit for URLs!") stop(400, "There's a 2048 character limit for URLs!")
if url == '': url = None return normalize_url(url)
return url
def _check_domain_ban_and_make_post_embed(url, v): def _check_domain_ban_and_make_post_embed(url, v):
if not url: if not url:
return None return None
embed = None embed = None
url = normalize_url(url)
domain = tldextract.extract(url).registered_domain domain = tldextract.extract(url).registered_domain
if v.admin_level < PERMS["IGNORE_DOMAIN_BAN"]: if v.admin_level < PERMS["IGNORE_DOMAIN_BAN"]: