From 78f88d9633eaf4cadcb5c42bc970ef49b6e2e7d4 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 8 Nov 2020 17:35:24 +0000 Subject: [PATCH] return null if text passed is null. Don't try to unescape it! Signed-off-by: Adam Warner --- scripts/pi-hole/js/utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js index 6fe90245..c83e7484 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -17,6 +17,8 @@ function escapeHtml(text) { "'": "'" }; + if (text === null) return null; + return text.replace(/[&<>"']/g, function (m) { return map[m]; }); @@ -31,6 +33,8 @@ function unescapeHtml(text) { "'": "'" }; + if (text === null) return null; + return text.replace(/&(?:amp|lt|gt|quot|#039);/g, function (m) { return map[m]; });