From 4f8de0d50d00e76e90d6ea6c29b6148ca2bdb710 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Wed, 30 Oct 2019 23:24:18 -0400 Subject: [PATCH] fix: replace tags with space in html cleanup for search (#1160) --- server/models/pages.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/models/pages.js b/server/models/pages.js index 24f0aa77..38eeb513 100644 --- a/server/models/pages.js +++ b/server/models/pages.js @@ -354,7 +354,9 @@ module.exports = class Page extends Model { // -> Update Search Index const pageContents = await WIKI.models.pages.query().findById(page.id).select('render') + console.info(pageContents.render) page.safeContent = WIKI.models.pages.cleanHTML(pageContents.render) + console.info(page.safeContent) await WIKI.data.searchEngine.updated(page) // -> Update on Storage @@ -842,7 +844,7 @@ module.exports = class Page extends Model { * @returns {string} Cleaned Content Text */ static cleanHTML(rawHTML = '') { - let data = striptags(rawHTML || '') + let data = striptags(rawHTML || '', [], ' ') .replace(emojiRegex(), '') // .replace(htmlEntitiesRegex, '') return he.decode(data)