From 05351b6b5533630204a5b4e7ce5cf53ec6b015ab Mon Sep 17 00:00:00 2001 From: binbin0325 Date: Thu, 27 Oct 2022 19:23:17 +0800 Subject: [PATCH] file add echo add -e param Signed-off-by: binbin0325 --- exec/file/file_add.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exec/file/file_add.go b/exec/file/file_add.go index e52bb9d..851716f 100644 --- a/exec/file/file_add.go +++ b/exec/file/file_add.go @@ -115,7 +115,7 @@ func (f *FileAddActionExecutor) Exec(uid string, ctx context.Context, model *spe } if exec.CheckFilepathExists(ctx, f.channel, filepath) { - log.Errorf(ctx,"`%s`: filepath is exist", filepath) + log.Errorf(ctx, "`%s`: filepath is exist", filepath) return spec.ResponseFailWithFlags(spec.ParameterInvalid, "filepath", filepath, "the filepath is exist") } @@ -130,7 +130,7 @@ func (f *FileAddActionExecutor) Exec(uid string, ctx context.Context, model *spe func (f *FileAddActionExecutor) start(cl spec.Channel, filepath, content string, directory, enableBase64, autoCreateDir bool, ctx context.Context) *spec.Response { dir := path.Dir(filepath) - if autoCreateDir && ! exec.CheckFilepathExists(ctx, cl, filepath) { + if autoCreateDir && !exec.CheckFilepathExists(ctx, cl, filepath) { if response := f.channel.Run(ctx, "mkdir", fmt.Sprintf(`-p %s`, dir)); !response.Success { return response } @@ -149,7 +149,7 @@ func (f *FileAddActionExecutor) start(cl spec.Channel, filepath, content string, content = string(decodeBytes) } } - return f.channel.Run(ctx, "echo", fmt.Sprintf(`"%s" >> "%s"`, content, filepath)) + return f.channel.Run(ctx, "echo", fmt.Sprintf(`-e "%s" >> "%s"`, content, filepath)) } } }