mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-25 01:20:35 +00:00
Merge pull request #3039 from dato/ap_image_url
Fix creation of covers for ActivityPub imports
This commit is contained in:
commit
ae51dcec63
1 changed files with 5 additions and 3 deletions
|
@ -483,10 +483,12 @@ class ImageField(ActivitypubFieldMixin, models.ImageField):
|
||||||
image_slug = value
|
image_slug = value
|
||||||
# when it's an inline image (User avatar/icon, Book cover), it's a json
|
# when it's an inline image (User avatar/icon, Book cover), it's a json
|
||||||
# blob, but when it's an attached image, it's just a url
|
# blob, but when it's an attached image, it's just a url
|
||||||
if hasattr(image_slug, "url"):
|
if isinstance(image_slug, str):
|
||||||
url = image_slug.url
|
|
||||||
elif isinstance(image_slug, str):
|
|
||||||
url = image_slug
|
url = image_slug
|
||||||
|
elif isinstance(image_slug, dict):
|
||||||
|
url = image_slug.get("url")
|
||||||
|
elif hasattr(image_slug, "url"): # Serialized to Image/Document object?
|
||||||
|
url = image_slug.url
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue