cope with & in titles

This commit is contained in:
rimu 2024-01-17 16:22:33 +13:00
parent ea224e291b
commit b072956289

View file

@ -432,7 +432,7 @@ def actor_json_to_model(activity_json, address, server):
def post_json_to_model(post_json, user, community) -> Post:
post = Post(user_id=user.id, community_id=community.id,
title=post_json['name'],
title=post_json['name'].replace('&', '&'),
comments_enabled=post_json['commentsEnabled'],
sticky=post_json['stickied'] if 'stickied' in post_json else False,
nsfw=post_json['sensitive'],
@ -987,7 +987,7 @@ def create_post_reply(activity_log: ActivityPubLog, community: Community, in_rep
def create_post(activity_log: ActivityPubLog, community: Community, request_json: dict, user: User, announce_id=None) -> Union[Post, None]:
post = Post(user_id=user.id, community_id=community.id,
title=request_json['object']['name'],
title=request_json['object']['name'].replace('&', '&'),
comments_enabled=request_json['object']['commentsEnabled'],
sticky=request_json['object']['stickied'] if 'stickied' in request_json['object'] else False,
nsfw=request_json['object']['sensitive'],