From f09cb7d160509e0a0aa0377375da13bc5e852f06 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 19 Apr 2024 05:42:49 +0000 Subject: [PATCH] fix: trim slash in RemoveSmbGlobalMapping --- pkg/os/smb/smb.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/os/smb/smb.go b/pkg/os/smb/smb.go index 30fb9cd479..b2f0252998 100644 --- a/pkg/os/smb/smb.go +++ b/pkg/os/smb/smb.go @@ -57,6 +57,7 @@ func NewSmbGlobalMapping(remotePath, username, password string) error { } func RemoveSmbGlobalMapping(remotePath string) error { + remotePath = strings.TrimSuffix(remotePath, `\`) cmd := `Remove-SmbGlobalMapping -RemotePath $Env:smbremotepath -Force` klog.V(2).Infof("begin to run RemoveSmbGlobalMapping with %s", remotePath) if output, err := util.RunPowershellCmd(cmd, fmt.Sprintf("smbremotepath=%s", remotePath)); err != nil {