From d6a35e6f594133b207048d7a409dd1e8c2ccc4fb Mon Sep 17 00:00:00 2001 From: Manohar Reddy Date: Wed, 19 May 2021 06:11:13 +0000 Subject: [PATCH] normalizeWindowsPath before doing NodeStage --- pkg/smb/smb_common_windows.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/smb/smb_common_windows.go b/pkg/smb/smb_common_windows.go index ae6a9aa9144..40264a29558 100644 --- a/pkg/smb/smb_common_windows.go +++ b/pkg/smb/smb_common_windows.go @@ -20,18 +20,23 @@ package smb import ( "fmt" - "os" - "github.com/kubernetes-csi/csi-driver-smb/pkg/mounter" "k8s.io/klog/v2" mount "k8s.io/mount-utils" + "os" + "strings" ) +func normalizeWindowsPath(path string) string { + return strings.Replace(path, "/", "\\", -1) +} + func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, mountOptions, sensitiveMountOptions []string) error { proxy, ok := m.Interface.(*mounter.CSIProxyMounter) if !ok { return fmt.Errorf("could not cast to csi proxy class") } + source = normalizeWindowsPath(source) return proxy.SMBMount(source, target, fsType, mountOptions, sensitiveMountOptions) }