Merge pull request #2113 from Dokploy/fix/schedules-rm

fix: prevent removal of current directory in deployment logs
This commit is contained in:
Mauricio Siu
2025-07-01 23:18:15 -06:00
committed by GitHub

View File

@@ -538,9 +538,11 @@ const removeLastTenDeployments = async (
await removeRollbackById(oldDeployment.rollbackId);
}
command += `
rm -rf ${logPath};
`;
if (logPath !== ".") {
command += `
rm -rf ${logPath};
`;
}
await removeDeployment(oldDeployment.deploymentId);
}
@@ -551,7 +553,11 @@ const removeLastTenDeployments = async (
await removeRollbackById(oldDeployment.rollbackId);
}
const logPath = path.join(oldDeployment.logPath);
if (existsSync(logPath) && !oldDeployment.errorMessage) {
if (
existsSync(logPath) &&
!oldDeployment.errorMessage &&
logPath !== "."
) {
await fsPromises.unlink(logPath);
}
await removeDeployment(oldDeployment.deploymentId);