From ce4254df14bcc2226de76e5078ec62f48104cb33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Wed, 5 May 2021 16:55:47 +0200 Subject: [PATCH] Fix: Broken design in case of maxCount not used --- dist/plex-meets-homeassistant.js | 17 ++++++++++------- src/modules/utils.ts | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 37e0e43..2887f86 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -18690,13 +18690,16 @@ class Plex { // eslint-disable-next-line @typescript-eslint/no-explicit-any const escapeHtml = (unsafe) => { - return unsafe - .toString() - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); + if (unsafe) { + return unsafe + .toString() + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + } + return ''; }; const CSS_STYLE = { diff --git a/src/modules/utils.ts b/src/modules/utils.ts index 57150be..573f6c8 100644 --- a/src/modules/utils.ts +++ b/src/modules/utils.ts @@ -1,12 +1,15 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any const escapeHtml = (unsafe: any): string => { - return unsafe - .toString() - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); + if (unsafe) { + return unsafe + .toString() + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + } + return ''; }; // eslint-disable-next-line import/prefer-default-export