From c55bf8fb8cf539363edf3b015326544a0846fdad Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Sun, 3 Jul 2022 12:12:30 +0200 Subject: [PATCH] update escape regex --- js/htmlescape.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/htmlescape.js b/js/htmlescape.js index 824a302..6a4faf2 100644 --- a/js/htmlescape.js +++ b/js/htmlescape.js @@ -1,7 +1,7 @@ const {replace} = ''; -const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g; -const ca = /[&<>'"]/g; +const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|\\\\|`);/g; +const ca = /[&<>'"\\\\`]/g; const esca = { '&': '&', @@ -9,8 +9,8 @@ const esca = { '>': '>', "'": ''', '"': '"', -'\\': '\\\\', -'`': '\\`' +'`': '\\`', +'\\': '\\\\' }; const pe = m => esca[m]; @@ -29,8 +29,8 @@ const unes = { ''': "'", '"': '"', '"': '"', -'\\\\': '\\', -'\\`': '`' +'\\`': '`', +'\\\\': '\\' }; const cape = m => unes[m];