From d204a9380a442e421ec75a05529eab31f9c983a5 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 2 Dec 2024 22:18:59 +0100 Subject: [PATCH] use path.Join to add /Workspace prefix --- libs/git/info.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/git/info.go b/libs/git/info.go index f2e0d548d..41412c49e 100644 --- a/libs/git/info.go +++ b/libs/git/info.go @@ -5,6 +5,7 @@ import ( "errors" "io/fs" "net/http" + "path" "strings" "github.com/databricks/cli/libs/dbr" @@ -83,11 +84,11 @@ func fetchRepositoryInfoAPI(ctx context.Context, path vfs.Path, w *databricks.Wo }, nil } -func ensureWorkspacePrefix(path string) string { - if !strings.HasPrefix(path, "/Workspace/") { - return "/Workspace/" + path +func ensureWorkspacePrefix(p string) string { + if !strings.HasPrefix(p, "/Workspace/") { + return path.Join("/Workspace", p) } - return path + return p } func fetchRepositoryInfoDotGit(ctx context.Context, path vfs.Path) (GitRepositoryInfo, error) {