mirror of
https://github.com/community-scripts/ProxmoxVE-Local.git
synced 2026-08-04 19:25:11 -04:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user