mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
avoid email domain missing error, fixes #229
This commit is contained in:
parent
ceb7cade62
commit
c8f7ecbe54
1 changed files with 1 additions and 1 deletions
|
|
@ -74,8 +74,8 @@ class LibRAvatarProvider:
|
|||
@classmethod
|
||||
def get_avatar_url(cls, user, width, _height=None):
|
||||
email = getattr(user, settings.AVATAR_GRAVATAR_FIELD).encode("utf-8")
|
||||
_, domain = email.split(b"@")
|
||||
try:
|
||||
_, domain = email.split(b"@")
|
||||
answers = dns.resolver.query("_avatars._tcp." + domain, "SRV")
|
||||
hostname = re.sub(r"\.$", "", str(answers[0].target))
|
||||
# query returns "example.com." and while http requests are fine with this,
|
||||
|
|
|
|||
Loading…
Reference in a new issue