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:
shreyas-goenka 2022-11-25 14:13:15 +01:00 committed by GitHub
parent 8e786d76a9
commit 761de12a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -44,10 +44,10 @@ const MaxRequestsInFlight = 20
//
// The workspace file system backend strips .py from the file name if the python
// 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()
// workspace mkdirs is idempotent
err := wsc.Workspace.MkdirsByPath(ctx, filepath.Dir(path))
err := wsc.Workspace.MkdirsByPath(ctx, path.Dir(remotePath))
if err != nil {
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(
"/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)
}