From 23f41cc1529daaa2804cb7caf0d4fb7866e2dab1 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Tue, 28 Oct 2025 22:05:50 +0000 Subject: [PATCH] fix(scriptindex): Handle missing script metadata fields in ScriptIndex.search to prevent crashes --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts/moxytool.classes.scriptindex.ts | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index f2b21e0..838dc16 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-10-28 - 1.4.2 - fix(scriptindex) +Handle missing script metadata fields in ScriptIndex.search to prevent crashes + +- Add null/undefined checks for name, slug, and description in ScriptIndex.search to avoid runtime exceptions when script metadata is incomplete +- Improves robustness of scripts search against partially populated or malformed cached metadata + ## 2025-10-28 - 1.4.1 - fix(cli) Fallback to 'unknown' when script.slug is missing in scripts list diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index f880528..733f827 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/moxytool', - version: '1.4.1', + version: '1.4.2', description: 'Proxmox administration tool for vGPU setup, VM management, and cluster configuration' } diff --git a/ts/moxytool.classes.scriptindex.ts b/ts/moxytool.classes.scriptindex.ts index c731cca..0e44f1d 100644 --- a/ts/moxytool.classes.scriptindex.ts +++ b/ts/moxytool.classes.scriptindex.ts @@ -263,9 +263,9 @@ export class ScriptIndex { return this.cache.scripts.filter((script) => { // Search in name, description, and slug return ( - script.name.toLowerCase().includes(lowerQuery) || - script.slug.toLowerCase().includes(lowerQuery) || - script.description.toLowerCase().includes(lowerQuery) + (script.name && script.name.toLowerCase().includes(lowerQuery)) || + (script.slug && script.slug.toLowerCase().includes(lowerQuery)) || + (script.description && script.description.toLowerCase().includes(lowerQuery)) ); }); }