forked from rDrama/rDrama
make banned domains case insensitive
parent
33d33a6468
commit
cc473795bf
|
@ -364,7 +364,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
|
||||||
if not href: continue
|
if not href: continue
|
||||||
url = urlparse(href)
|
url = urlparse(href)
|
||||||
d = tldextract.extract(href).registered_domain + url.path
|
d = tldextract.extract(href).registered_domain + url.path
|
||||||
domain_list.add(d)
|
domain_list.add(d.lower())
|
||||||
|
|
||||||
banned_domains = g.db.query(BannedDomain).all()
|
banned_domains = g.db.query(BannedDomain).all()
|
||||||
for x in banned_domains:
|
for x in banned_domains:
|
||||||
|
|
|
@ -1386,7 +1386,7 @@ def admin_banned_domains(v):
|
||||||
@admin_level_required(PERMS['DOMAINS_BAN'])
|
@admin_level_required(PERMS['DOMAINS_BAN'])
|
||||||
def ban_domain(v):
|
def ban_domain(v):
|
||||||
|
|
||||||
domain=request.values.get("domain", "").strip()
|
domain=request.values.get("domain", "").strip().lower()
|
||||||
if not domain: abort(400)
|
if not domain: abort(400)
|
||||||
|
|
||||||
reason=request.values.get("reason").strip()
|
reason=request.values.get("reason").strip()
|
||||||
|
|
|
@ -687,6 +687,7 @@ def submit_post(v, sub=None):
|
||||||
return redirect(repost.permalink)
|
return redirect(repost.permalink)
|
||||||
|
|
||||||
y = tldextract.extract(url).registered_domain + parsed_url.path
|
y = tldextract.extract(url).registered_domain + parsed_url.path
|
||||||
|
y = y.lower()
|
||||||
banned_domains = g.db.query(BannedDomain).all()
|
banned_domains = g.db.query(BannedDomain).all()
|
||||||
for x in banned_domains:
|
for x in banned_domains:
|
||||||
if y.startswith(x.domain):
|
if y.startswith(x.domain):
|
||||||
|
|
Loading…
Reference in New Issue