From 10aedd8bd9fc3434e86adebe10cd8ad5c7a042e6 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Wed, 27 May 2026 13:25:53 +0200 Subject: [PATCH] fix: use exact match for config file existence check in isVM (#584) The checkPathExists helper echoed 'not_exists' but checked via data.includes('exists'), which matched both 'exists' AND 'not_exists'. This caused isVM() to always return true, making pct destroy fail because the code ran qm destroy on LXC containers instead. Change the echo sentinel to 'not_found' and compare with trim() === 'exists' to ensure an unambiguous match. --- src/server/api/routers/installedScripts.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/api/routers/installedScripts.ts b/src/server/api/routers/installedScripts.ts index 5f44b5d..ee6ade4 100644 --- a/src/server/api/routers/installedScripts.ts +++ b/src/server/api/routers/installedScripts.ts @@ -446,9 +446,9 @@ async function isVM(scriptId: number, containerId: string, serverId: number | nu let exists = false; void sshExecutionService.executeCommand( server as Server, - `test -f "${path}" && echo "exists" || echo "not_exists"`, + `test -f "${path}" && echo "exists" || echo "not_found"`, (data: string) => { - if (data.includes('exists')) exists = true; + if (data.trim() === 'exists') exists = true; }, () => resolve(exists), () => resolve(exists)