mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-23 05:52:05 +02:00
fix: #12733, html present in generated title for remote topics
This commit is contained in:
@@ -13,6 +13,7 @@ const request = require('../request');
|
|||||||
const db = require('../database');
|
const db = require('../database');
|
||||||
const ttl = require('../cache/ttl');
|
const ttl = require('../cache/ttl');
|
||||||
const user = require('../user');
|
const user = require('../user');
|
||||||
|
const utils = require('../utils');
|
||||||
const activitypub = require('.');
|
const activitypub = require('.');
|
||||||
|
|
||||||
const webfingerRegex = /^(@|acct:)?[\w-]+@.+$/;
|
const webfingerRegex = /^(@|acct:)?[\w-]+@.+$/;
|
||||||
@@ -288,6 +289,9 @@ Helpers.generateTitle = (html) => {
|
|||||||
// Fall back to newline splitting (i.e. if no paragraph elements)
|
// Fall back to newline splitting (i.e. if no paragraph elements)
|
||||||
title = title || html.split('\n').filter(Boolean).shift();
|
title = title || html.split('\n').filter(Boolean).shift();
|
||||||
|
|
||||||
|
// Strip html
|
||||||
|
title = utils.stripHTMLTags(title);
|
||||||
|
|
||||||
// Split sentences and use only first one
|
// Split sentences and use only first one
|
||||||
const sentences = title
|
const sentences = title
|
||||||
.split(/(\.|\?|!)\s/)
|
.split(/(\.|\?|!)\s/)
|
||||||
|
|||||||
Reference in New Issue
Block a user