Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix code-scanning findings: logger nullish coalescing and escapeRegExp

rcourtman4bfd211a766a
diff --git a/frontend-modern/src/utils/logger.ts b/frontend-modern/src/utils/logger.ts
index 4c09db316a..63c4b64594 100644
--- a/frontend-modern/src/utils/logger.ts
+++ b/frontend-modern/src/utils/logger.ts
@@ -3,7 +3,7 @@ const isDev = import.meta.env.DEV;
export const logger = {
debug: (message: string, data?: unknown) => {
- if (isDev) console.log(`[DEBUG] ${message}`, data || '');
+ if (isDev) console.log(`[DEBUG] ${message}`, data ?? '');
},
info: (message: string, data?: unknown) => {
@@ -14,16 +14,16 @@ export const logger = {
message.includes('error') ||
message.includes('failed')
) {
- console.log(`[INFO] ${message}`, data || '');
+ console.log(`[INFO] ${message}`, data ?? '');
}
},
warn: (message: string, data?: unknown) => {
- console.warn(`[WARN] ${message}`, data || '');
+ console.warn(`[WARN] ${message}`, data ?? '');
},
error: (message: string, error?: unknown) => {
- console.error(`[ERROR] ${message}`, error || '');
+ console.error(`[ERROR] ${message}`, error ?? '');
},
};
diff --git a/frontend-modern/src/utils/nodes.ts b/frontend-modern/src/utils/nodes.ts
index fa529bb974..917ab299ac 100644
--- a/frontend-modern/src/utils/nodes.ts
+++ b/frontend-modern/src/utils/nodes.ts
@@ -9,7 +9,7 @@ const sanitize = (value: string): string =>
.toLowerCase()
.replace(/[^a-z0-9]/g, '');
-const escapeRegExp = (value: string): string => value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\$&');
+const escapeRegExp = (value: string): string => value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
const extractHostname = (value: string): string => {
if (!value) return '';