From 993b34eca69db67726cab5dd86c19fcec19e4360 Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Fri, 30 Aug 2024 11:29:06 +0800 Subject: [PATCH] Fix the issue with SSH deployment failing to upload the certificate. --- internal/deployer/ssh.go | 2 +- internal/deployer/ssh_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 internal/deployer/ssh_test.go diff --git a/internal/deployer/ssh.go b/internal/deployer/ssh.go index 78186309..8e3aacbf 100644 --- a/internal/deployer/ssh.go +++ b/internal/deployer/ssh.go @@ -99,7 +99,7 @@ func (s *ssh) upload(client *sshPkg.Client, content, path string) error { } defer sftpCli.Close() - if err := sftpCli.MkdirAll(xpath.Base(path)); err != nil { + if err := sftpCli.MkdirAll(xpath.Dir(path)); err != nil { return fmt.Errorf("failed to create remote directory: %w", err) } diff --git a/internal/deployer/ssh_test.go b/internal/deployer/ssh_test.go new file mode 100644 index 00000000..909b68e2 --- /dev/null +++ b/internal/deployer/ssh_test.go @@ -0,0 +1,12 @@ +package deployer + +import ( + "os" + "path" + "testing" +) + +func TestPath(t *testing.T) { + dir := path.Dir("./a/b/c") + os.MkdirAll(dir, 0755) +}