mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-15 00:15:17 +00:00
fix: prevent removal of current directory in deployment logs
- Updated the removeLastTenDeployments function to check if logPath is not the current directory before executing the removal command. - Enhanced the unlink operation to ensure it only attempts to delete valid log paths.
This commit is contained in:
@@ -538,9 +538,11 @@ const removeLastTenDeployments = async (
|
|||||||
await removeRollbackById(oldDeployment.rollbackId);
|
await removeRollbackById(oldDeployment.rollbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
command += `
|
if (logPath !== ".") {
|
||||||
rm -rf ${logPath};
|
command += `
|
||||||
`;
|
rm -rf ${logPath};
|
||||||
|
`;
|
||||||
|
}
|
||||||
await removeDeployment(oldDeployment.deploymentId);
|
await removeDeployment(oldDeployment.deploymentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,7 +553,11 @@ const removeLastTenDeployments = async (
|
|||||||
await removeRollbackById(oldDeployment.rollbackId);
|
await removeRollbackById(oldDeployment.rollbackId);
|
||||||
}
|
}
|
||||||
const logPath = path.join(oldDeployment.logPath);
|
const logPath = path.join(oldDeployment.logPath);
|
||||||
if (existsSync(logPath) && !oldDeployment.errorMessage) {
|
if (
|
||||||
|
existsSync(logPath) &&
|
||||||
|
!oldDeployment.errorMessage &&
|
||||||
|
logPath !== "."
|
||||||
|
) {
|
||||||
await fsPromises.unlink(logPath);
|
await fsPromises.unlink(logPath);
|
||||||
}
|
}
|
||||||
await removeDeployment(oldDeployment.deploymentId);
|
await removeDeployment(oldDeployment.deploymentId);
|
||||||
|
|||||||
Reference in New Issue
Block a user