From 5c3f1cfe5750170beec81e7a70f8d1fde0ca3b25 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 26 Feb 2025 13:36:06 -0500 Subject: [PATCH] fix: tag handling when remote objects contain tags without leading # symbol --- src/activitypub/notes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 4bf74140e7..26dbbc0bd1 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -162,8 +162,12 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { const systemTags = (meta.config.systemTags || '').split(','); const maxTags = await categories.getCategoryField(cid, 'maxTags'); tags = (mainPost._activitypub.tag || []) - .filter(o => o.type === 'Hashtag' && !systemTags.includes(o.name.slice(1))) - .map(o => o.name.slice(1)); + .map((tag) => { + tag.name = tag.name.startsWith('#') ? tag.name.slice(1) : tag.name; + return tag; + }) + .filter(o => o.type === 'Hashtag' && !systemTags.includes(o.name)) + .map(t => t.name); if (tags.length > maxTags) { tags.length = maxTags;