From eff55da020914f2e4a3f5290124c3f9f3e68eb43 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Sun, 28 Sep 2025 15:51:53 +0800 Subject: [PATCH] fix: Fix the issue of double quote escaping in cronjob (#10519) --- agent/app/service/cronjob_helper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/app/service/cronjob_helper.go b/agent/app/service/cronjob_helper.go index 5e9b637d4..949fccbbb 100644 --- a/agent/app/service/cronjob_helper.go +++ b/agent/app/service/cronjob_helper.go @@ -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"