From c9883c07c03612c3a9e4da9fa48945f4cdf5fe6a Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 29 Sep 2024 17:15:47 +1300 Subject: [PATCH] strip post title - activitypub --- app/activitypub/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index c82f702d..47ca6a63 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -1619,7 +1619,7 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json else: return None else: - title = request_json['object']['name'] + title = request_json['object']['name'].strip() nsfl_in_title = '[NSFL]' in title.upper() or '(NSFL)' in title.upper() post = Post(user_id=user.id, community_id=community.id, @@ -1658,9 +1658,9 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json if microblog: autogenerated_title = microblog_content_to_title(post.body_html) if len(autogenerated_title) < 20: - title = '[Microblog] ' + autogenerated_title + title = '[Microblog] ' + autogenerated_title.strip() else: - title = autogenerated_title + title = autogenerated_title.strip() if '[NSFL]' in title.upper() or '(NSFL)' in title.upper(): post.nsfl = True if '[NSFW]' in title.upper() or '(NSFW)' in title.upper():