use path.Join to add /Workspace prefix

This commit is contained in:
Denis Bilenko 2024-12-02 22:18:59 +01:00
parent 242b53a23d
commit d204a9380a
1 changed files with 5 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"errors" "errors"
"io/fs" "io/fs"
"net/http" "net/http"
"path"
"strings" "strings"
"github.com/databricks/cli/libs/dbr" "github.com/databricks/cli/libs/dbr"
@ -83,11 +84,11 @@ func fetchRepositoryInfoAPI(ctx context.Context, path vfs.Path, w *databricks.Wo
}, nil }, nil
} }
func ensureWorkspacePrefix(path string) string { func ensureWorkspacePrefix(p string) string {
if !strings.HasPrefix(path, "/Workspace/") { if !strings.HasPrefix(p, "/Workspace/") {
return "/Workspace/" + path return path.Join("/Workspace", p)
} }
return path return p
} }
func fetchRepositoryInfoDotGit(ctx context.Context, path vfs.Path) (GitRepositoryInfo, error) { func fetchRepositoryInfoDotGit(ctx context.Context, path vfs.Path) (GitRepositoryInfo, error) {