From 347471222869dc5fb84c31fa608d118e5a52d922 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 13 Aug 2024 14:50:08 -0400 Subject: [PATCH] fix: #12733, html present in generated title for remote topics --- src/activitypub/helpers.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/activitypub/helpers.js b/src/activitypub/helpers.js index f46d2644c9..6652f12df0 100644 --- a/src/activitypub/helpers.js +++ b/src/activitypub/helpers.js @@ -13,6 +13,7 @@ const request = require('../request'); const db = require('../database'); const ttl = require('../cache/ttl'); const user = require('../user'); +const utils = require('../utils'); const activitypub = require('.'); const webfingerRegex = /^(@|acct:)?[\w-]+@.+$/; @@ -288,6 +289,9 @@ Helpers.generateTitle = (html) => { // Fall back to newline splitting (i.e. if no paragraph elements) title = title || html.split('\n').filter(Boolean).shift(); + // Strip html + title = utils.stripHTMLTags(title); + // Split sentences and use only first one const sentences = title .split(/(\.|\?|!)\s/)