core: Fix bug causing whitespace only names to raise exception when generating avatars (#4746)
Fix bug causing whitespace only names to raise exception when generating avatars Signed-off-by: sdimovv <36302090+sdimovv@users.noreply.github.com>
This commit is contained in:
parent
2c78053631
commit
175502b053
|
@ -154,7 +154,7 @@ def generate_avatar_from_name(
|
||||||
|
|
||||||
def avatar_mode_generated(user: "User", mode: str) -> Optional[str]:
|
def avatar_mode_generated(user: "User", mode: str) -> Optional[str]:
|
||||||
"""Wrapper that converts generated avatar to base64 svg"""
|
"""Wrapper that converts generated avatar to base64 svg"""
|
||||||
svg = generate_avatar_from_name(user.name if user.name != "" else "a k")
|
svg = generate_avatar_from_name(user.name if user.name.strip() != "" else "a k")
|
||||||
return f"data:image/svg+xml;base64,{b64encode(svg.encode('utf-8')).decode('utf-8')}"
|
return f"data:image/svg+xml;base64,{b64encode(svg.encode('utf-8')).decode('utf-8')}"
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue