Node.js based forum software built for the modern web
fix: tag handling when remote objects contain tags without leading # symbol
Julian Lam5c3f1cfe5750
diff --git a/src/activitypub/notes.js b/src/activitypub/notes.jsindex 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;