From b66c30a2a73d06c45a6b6d97607b0d9378d56b87 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 15 Sep 2025 14:10:02 -0400 Subject: [PATCH] fix: handle cases where incoming ap object tag can be a non-array --- src/activitypub/notes.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 733aff354f..ef4abe9add 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -31,7 +31,13 @@ async function unlock(value) { Notes._normalizeTags = async (tag, cid) => { const systemTags = (meta.config.systemTags || '').split(','); const maxTags = await categories.getCategoryField(cid, 'maxTags'); - const tags = (tag || []) + let tags = tag || []; + + if (!Array.isArray(tags)) { // the "|| []" should handle null/undefined values... #famouslastwords + tags = [tags]; + } + + tags = tags .map((tag) => { tag.name = tag.name.startsWith('#') ? tag.name.slice(1) : tag.name; return tag;