fix: Fix the issue of double quote escaping in cronjob (#10519)

This commit is contained in:
ssongliu 2025-09-28 15:51:53 +08:00 committed by GitHub
parent e87bf0b3fc
commit eff55da020
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -147,9 +147,9 @@ func (u *CronjobService) handleShell(cronjob model.Cronjob, taskItem *task.Task)
command = cronjob.Command
}
if len(cronjob.User) != 0 {
return cmdMgr.Run("docker", "exec", "-u", cronjob.User, cronjob.ContainerName, command, "-c", strings.ReplaceAll(scriptItem, "\"", "\\\""))
return cmdMgr.Run("docker", "exec", "-u", cronjob.User, cronjob.ContainerName, command, "-c", scriptItem)
}
return cmdMgr.Run("docker", "exec", cronjob.ContainerName, command, "-c", strings.ReplaceAll(scriptItem, "\"", "\\\""))
return cmdMgr.Run("docker", "exec", cronjob.ContainerName, command, "-c", scriptItem)
}
if len(cronjob.Executor) == 0 {
cronjob.Executor = "bash"