@@ -2467,15 +2467,21 @@ def check_supported(cls, obj, direction):
24672467 and inner_type not in cls .SUPPORTED_AS1_TYPES )):
24682468 error (f"Bridgy Fed for { cls .LABEL } doesn't support { obj .type } { inner_type } yet" , status = 204 )
24692469
2470- # don't allow posts with blank content and no image/video/audio
2470+ # don't allow posts with blank content and no image/video/audio/link
24712471 crud_obj = (as1 .get_object (obj .as1 ) if obj .type in ('post' , 'update' )
24722472 else obj .as1 )
2473+ links = [att for att in as1 .get_objects (crud_obj , 'attachments' )
2474+ if att .get ('objectType' ) == 'link' ]
24732475 if (crud_obj .get ('objectType' ) in as1 .POST_TYPES
24742476 and not util .get_url (crud_obj , key = 'image' )
2475- and not any (util .get_urls (crud_obj , 'attachments' , inner_key = 'stream' ))
2477+ and not util .get_urls (crud_obj , 'attachments' , inner_key = 'stream' )
2478+ # link attachments get moved into content, eg in
2479+ # activitypub.postprocess_as2
2480+ # https://github.com/snarfed/bridgy-fed/issues/2658
2481+ and not any (util .get_url (l ) for l in links )
24762482 # TODO: handle articles with displayName but not content
24772483 and not source .html_to_text (crud_obj .get ('content' )).strip ()):
2478- error ('Blank content and no image or video or audio' , status = 204 )
2484+ error ('Blank content and no image or video or audio or link ' , status = 204 )
24792485
24802486 # receiving DMs is only allowed to protocol bot accounts
24812487 if direction == 'receive' :
0 commit comments