Skip to content

Commit 4322716

Browse files
authored
Merge pull request #98 from marosset/smb-remotepath-add-backslash
fix: add trailing backslash to remote path when linking to SMB shares
2 parents 4ea9a2e + 76fce59 commit 4322716

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/os/smb/api.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ func (APIImplementor) IsSmbMapped(remotePath string) (bool, error) {
3838
// alpha to merge the paths.
3939
// TODO (for beta release): Merge the link paths - os.Symlink and Powershell link path.
4040
func (APIImplementor) NewSmbLink(remotePath, localPath string) error {
41+
42+
if !strings.HasSuffix(remotePath, "\\") {
43+
// Golang has issues resolving paths mapped to file shares if they do not end in a trailing \
44+
// so add one if needed.
45+
remotePath = remotePath + "\\"
46+
}
47+
4148
cmdLine := fmt.Sprintf(`New-Item -ItemType SymbolicLink $Env:smblocalPath -Target $Env:smbremotepath`)
4249
cmd := exec.Command("powershell", "/c", cmdLine)
4350
cmd.Env = append(os.Environ(),

0 commit comments

Comments
 (0)