mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 00:50:35 +00:00
Fix creation of covers for ActivityPub imports
`cover` comes as a JSON dict, but the code was looking for URL as an attribute. (This commit leaves the attribute access in place, just in case `cover` is updated to serialize as Document proper.)
This commit is contained in:
parent
6667178703
commit
3251ef0bf5
1 changed files with 5 additions and 3 deletions
|
@ -482,10 +482,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