mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
avoid empty attachment list
This commit is contained in:
parent
73f0ff35f4
commit
6cc3d14a2a
2 changed files with 2 additions and 2 deletions
|
@ -1833,7 +1833,7 @@ def update_post_from_activity(post: Post, request_json: dict):
|
|||
# Links
|
||||
old_url = post.url
|
||||
new_url = None
|
||||
if 'attachment' in request_json['object'] and isinstance(request_json['object']['attachment'], list) and \
|
||||
if 'attachment' in request_json['object'] and isinstance(request_json['object']['attachment'], list) and len(request_json['object']['attachment']) > 0 and \
|
||||
'type' in request_json['object']['attachment'][0]:
|
||||
if request_json['object']['attachment'][0]['type'] == 'Link':
|
||||
new_url = request_json['object']['attachment'][0]['href'] # Lemmy < 0.19.4
|
||||
|
|
|
@ -1227,7 +1227,7 @@ class Post(db.Model):
|
|||
if blocked_phrase in post.body:
|
||||
return None
|
||||
|
||||
if 'attachment' in request_json['object'] and isinstance(request_json['object']['attachment'], list) and \
|
||||
if 'attachment' in request_json['object'] and isinstance(request_json['object']['attachment'], list) and len(request_json['object']['attachment']) > 0 and \
|
||||
'type' in request_json['object']['attachment'][0]:
|
||||
alt_text = None
|
||||
if request_json['object']['attachment'][0]['type'] == 'Link':
|
||||
|
|
Loading…
Add table
Reference in a new issue