Skip to content

Commit

Permalink
avoid email domain missing error, fixes #229
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswilm committed Oct 16, 2023
1 parent ceb7cad commit c8f7ecb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion avatar/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c8f7ecb

Please sign in to comment.