make banned domains case insensitive

master
Aevann1 2022-10-31 16:33:11 +02:00
parent 33d33a6468
commit cc473795bf
3 changed files with 3 additions and 2 deletions

View File

@ -364,7 +364,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
if not href: continue
url = urlparse(href)
d = tldextract.extract(href).registered_domain + url.path
domain_list.add(d)
domain_list.add(d.lower())
banned_domains = g.db.query(BannedDomain).all()
for x in banned_domains:

View File

@ -1386,7 +1386,7 @@ def admin_banned_domains(v):
@admin_level_required(PERMS['DOMAINS_BAN'])
def ban_domain(v):
domain=request.values.get("domain", "").strip()
domain=request.values.get("domain", "").strip().lower()
if not domain: abort(400)
reason=request.values.get("reason").strip()

View File

@ -687,6 +687,7 @@ def submit_post(v, sub=None):
return redirect(repost.permalink)
y = tldextract.extract(url).registered_domain + parsed_url.path
y = y.lower()
banned_domains = g.db.query(BannedDomain).all()
for x in banned_domains:
if y.startswith(x.domain):