From 27e40a3b65c82807a3bf15a0e56b6f24fceb89f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 25 Jan 2023 23:42:33 +0100 Subject: [PATCH] Empty string handling fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/AuthorizedTagsCache.ts | 2 +- src/charging-station/ChargingStation.ts | 2 +- src/charging-station/ChargingStationUtils.ts | 2 +- src/utils/Configuration.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/charging-station/AuthorizedTagsCache.ts b/src/charging-station/AuthorizedTagsCache.ts index 5808f02b..a2b180e3 100644 --- a/src/charging-station/AuthorizedTagsCache.ts +++ b/src/charging-station/AuthorizedTagsCache.ts @@ -35,7 +35,7 @@ export default class AuthorizedTagsCache { file, null, (event, filename) => { - if (filename && event === 'change') { + if (!Utils.isEmptyString(filename) && event === 'change') { try { logger.debug( `${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload` diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index ddaff652..276c8368 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -511,7 +511,7 @@ export default class ChargingStation { this.templateFile, null, (event, filename): void => { - if (filename && event === 'change') { + if (!Utils.isEmptyString(filename) && event === 'change') { try { logger.debug( `${this.logPrefix()} ${FileType.ChargingStationTemplate} ${ diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 9b371d14..e73f4d50 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -210,7 +210,7 @@ export class ChargingStationUtils { if (!Utils.isUndefined(template[key])) { logger.warn( `${logPrefix} Deprecated template key '${key}' usage in file '${templateFile}'${ - logMsgToAppend && `. ${logMsgToAppend}` + !Utils.isEmptyString(logMsgToAppend) && `. ${logMsgToAppend}` }` ); } diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 5df7bdc5..b1926e16 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -336,13 +336,13 @@ export default class Configuration { ) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage in section '${sectionName}'${ - logMsgToAppend && `. ${logMsgToAppend}` + logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}` }}` ); } else if (!Configuration.isUndefined(Configuration.getConfig()[key])) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${ - logMsgToAppend && `. ${logMsgToAppend}` + logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}` }}` ); } -- 2.34.1