mirror of https://github.com/databricks/cli.git
Fix incorrect remote path arg to APIs in windows on bricks sync (#101)
Integration tests testing sync on ubuntu are green: <img width="794" alt="Screenshot 2022-11-25 at 2 05 11 PM" src="https://user-images.githubusercontent.com/88374338/203991936-f0478c35-5d97-429b-b373-f050d9a90cff.png"> @fjakobs tested this on windows manually
This commit is contained in:
parent
8e786d76a9
commit
761de12a0d
|
@ -44,10 +44,10 @@ const MaxRequestsInFlight = 20
|
||||||
//
|
//
|
||||||
// The workspace file system backend strips .py from the file name if the python
|
// The workspace file system backend strips .py from the file name if the python
|
||||||
// file is a notebook
|
// file is a notebook
|
||||||
func putFile(ctx context.Context, path string, content io.Reader) error {
|
func putFile(ctx context.Context, remotePath string, content io.Reader) error {
|
||||||
wsc := project.Get(ctx).WorkspacesClient()
|
wsc := project.Get(ctx).WorkspacesClient()
|
||||||
// workspace mkdirs is idempotent
|
// workspace mkdirs is idempotent
|
||||||
err := wsc.Workspace.MkdirsByPath(ctx, filepath.Dir(path))
|
err := wsc.Workspace.MkdirsByPath(ctx, path.Dir(remotePath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not mkdir to put file: %s", err)
|
return fmt.Errorf("could not mkdir to put file: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ func putFile(ctx context.Context, path string, content io.Reader) error {
|
||||||
}
|
}
|
||||||
apiPath := fmt.Sprintf(
|
apiPath := fmt.Sprintf(
|
||||||
"/api/2.0/workspace-files/import-file/%s?overwrite=true",
|
"/api/2.0/workspace-files/import-file/%s?overwrite=true",
|
||||||
strings.TrimLeft(path, "/"))
|
strings.TrimLeft(remotePath, "/"))
|
||||||
return apiClient.Do(ctx, http.MethodPost, apiPath, content, nil)
|
return apiClient.Do(ctx, http.MethodPost, apiPath, content, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue