Skip to content

Node.js based forum software built for the modern web

fix: #12733, html present in generated title for remote topics

Julian Lam347471222869
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/)