Skip to content

Commit 2e9f563

Browse files
committed
convert / to \ for abs path check using filepath
1 parent d2582ed commit 2e9f563

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cli/open.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func isWindowsAbsPath(p string) bool {
251251
switch {
252252
case len(p) == 0:
253253
return false
254-
case p[0] == '/' || p[0] == '\\':
254+
case p[0] == '\\':
255255
return true
256256
default:
257257
return false
@@ -305,11 +305,12 @@ func resolveAgentAbsPath(workingDirectory, relOrAbsPath, agentOS string, local b
305305
return p, nil
306306

307307
case agentOS == "windows":
308+
relOrAbsPath = strings.ReplaceAll(relOrAbsPath, "/", "\\")
308309
switch {
309310
case workingDirectory != "" && !isWindowsAbsPath(relOrAbsPath):
310311
return windowsJoinPath(workingDirectory, relOrAbsPath), nil
311312
case isWindowsAbsPath(relOrAbsPath):
312-
return windowsJoinPath(relOrAbsPath), nil
313+
return relOrAbsPath, nil
313314
default:
314315
return "", xerrors.Errorf("path %q not supported, use an absolute path instead", relOrAbsPath)
315316
}

0 commit comments

Comments
 (0)