From 6864d07dd95ca8a1cba76da5310835acf7f6eed0 Mon Sep 17 00:00:00 2001 From: K1ngfish3r Date: Tue, 28 May 2024 13:51:36 +0800 Subject: [PATCH] Remove html entity replace function when sanitizing text (#1049) * add spacing between <> * remove check entirely * fix ol tag --- src/screens/reader/utils/sanitizeChapterText.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/screens/reader/utils/sanitizeChapterText.ts b/src/screens/reader/utils/sanitizeChapterText.ts index 59db609a..c3370106 100644 --- a/src/screens/reader/utils/sanitizeChapterText.ts +++ b/src/screens/reader/utils/sanitizeChapterText.ts @@ -9,9 +9,6 @@ export const sanitizeChapterText = ( html: string, options?: Options, ): string => { - if (html) { - html = html.replace(/</g, '<').replace(/>/g, '>'); - } let text = sanitizeHtml(html, { allowedTags: sanitizeHtml.defaults.allowedTags.concat([ 'img', @@ -20,10 +17,13 @@ export const sanitizeChapterText = ( 'b', 'a', 'div', + 'ol', + 'li', ]), allowedAttributes: { 'img': ['src'], 'a': ['href'], + 'ol': ['reversed', 'start', 'type'], }, allowedSchemes: ['data', 'http', 'https', 'file'], });