feat: compatible custom avatar url (#26975)
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
@@ -81,6 +81,8 @@ class AvatarUrlField(fields.Raw):
|
|||||||
from models import Account
|
from models import Account
|
||||||
|
|
||||||
if isinstance(obj, Account) and obj.avatar is not None:
|
if isinstance(obj, Account) and obj.avatar is not None:
|
||||||
|
if obj.avatar.startswith(("http://", "https://")):
|
||||||
|
return obj.avatar
|
||||||
return file_helpers.get_signed_file_url(obj.avatar)
|
return file_helpers.get_signed_file_url(obj.avatar)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user