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.
This commit is contained in:
MickLesk
2026-05-27 13:25:53 +02:00
parent ae48c1bf89
commit 10aedd8bd9

View File

@@ -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)