mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
image is a dict while attachment is a list of dicts
argh
This commit is contained in:
parent
367f80f13a
commit
b83ae5fa2f
1 changed files with 2 additions and 1 deletions
|
@ -382,7 +382,8 @@ def add_post(actor):
|
|||
if post.type == POST_TYPE_LINK:
|
||||
page['attachment'] = [{'href': post.url, 'type': 'Link'}]
|
||||
if post.image_id:
|
||||
page['image'] = [{'type': 'Image', 'url': post.image.file_path.replace('app/static/', f"https://{current_app.config['SERVER_NAME']}/static/")}]
|
||||
# NB image is a dict while attachment is a list of dicts (usually just one dict in the list)
|
||||
page['image'] = {'type': 'Image', 'url': post.image.file_path.replace('app/static/', f"https://{current_app.config['SERVER_NAME']}/static/")}
|
||||
page['attachment'] = [{'type': 'Link', 'href': post.image.source_url}] # source_url is always a https link, no need for .replace() as done above
|
||||
if not community.is_local(): # this is a remote community - send the post to the instance that hosts it
|
||||
success = post_request(community.ap_inbox_url, create, current_user.private_key,
|
||||
|
|
Loading…
Reference in a new issue