Permalink
Browse files

Domainban: Take TLDs into account

  • Loading branch information...
1 parent 1acb235 commit 8730de12203862a3f1c950ee2aa89a395036c961 Roger Ostrander committed with chromakode Feb 26, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 r2/r2/models/account.py
@@ -538,11 +538,11 @@ def which_emails_are_banned(cls, canons):
canons_by_domain[domain].append(canon)
# Now, build a list of subdomains to check for ban status; for
- # abc@foo.bar.com, we need to check foo.bar.com and bar.com
+ # abc@foo.bar.com, we need to check foo.bar.com, bar.com, and .com
canons_by_subdomain = {}
for domain, canons in canons_by_domain.iteritems():
parts = domain.rstrip(".").split(".")
- while len(parts) >= 2:
+ while len(parts) >= 1:
whole = ".".join(parts)
canons_by_subdomain.setdefault(whole, [])
canons_by_subdomain[whole].extend(canons)

0 comments on commit 8730de1

Please sign in to comment.