Skip to content

Commit

Permalink
normalizeWindowsPath before doing NodeStage
Browse files Browse the repository at this point in the history
  • Loading branch information
boddumanohar committed May 24, 2021
1 parent c45d920 commit d6a35e6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/smb/smb_common_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit d6a35e6

Please sign in to comment.