mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
fix: #12866 again, more tests
This commit is contained in:
@@ -313,7 +313,7 @@ Helpers.generateTitle = (html) => {
|
||||
|
||||
// Try the first paragraph-like element
|
||||
const match = html.match(titleRegex);
|
||||
if (match) {
|
||||
if (match && match.index === 0) {
|
||||
title = match[2];
|
||||
}
|
||||
|
||||
@@ -332,6 +332,8 @@ Helpers.generateTitle = (html) => {
|
||||
.reduce((memo, cur, idx, sentences) => {
|
||||
if (idx % 2) {
|
||||
memo.push(`${sentences[idx - 1]}${cur}`);
|
||||
} else if (idx === sentences.length - 1) {
|
||||
memo.push(cur);
|
||||
}
|
||||
|
||||
return memo;
|
||||
|
||||
Reference in New Issue
Block a user