Skip to content

Commit e86499f

Browse files
committed
remove filepath fallbacks on windows, go abs check is stricter
1 parent 869545c commit e86499f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

cli/open.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,9 @@ func waitForAgentCond(ctx context.Context, client *codersdk.Client, workspace co
236236
return workspace, workspaceAgent, xerrors.New("watch workspace: unexpected closed channel")
237237
}
238238

239-
// isWindowsAbsPath checks if the path is an absolute path on Windows. On Unix
240-
// systems the check is very simplistic and does not cover edge cases.
239+
// isWindowsAbsPath does a simplistic check for if the path is an absolute path
240+
// on Windows. Drive letter or preceding `\` is interpreted as absolute.
241241
func isWindowsAbsPath(p string) bool {
242-
if runtime.GOOS == "windows" {
243-
return filepath.IsAbs(p)
244-
}
245-
246242
// Remove the drive letter, if present.
247243
if len(p) >= 2 && p[1] == ':' {
248244
p = p[2:]
@@ -259,8 +255,7 @@ func isWindowsAbsPath(p string) bool {
259255
}
260256

261257
// windowsJoinPath joins the elements into a path, using Windows path separator
262-
// and converting forward slashes to backslashes. On Unix systems a very
263-
// simplistic join operator is used.
258+
// and converting forward slashes to backslashes.
264259
func windowsJoinPath(elem ...string) string {
265260
if runtime.GOOS == "windows" {
266261
return filepath.Join(elem...)

0 commit comments

Comments
 (0)