Skip to content

Commit

Permalink
File upload & download are paths and should be escaped like that
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaldjorMike committed Sep 14, 2022
1 parent 974607f commit c952a99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (f *Files) Upload(viewName string, fileName string, reader io.Reader) error

eg.Go(func() error {
var err error
resp, err = f.client.HTTPRequestContext(ctx, http.MethodPost, fmt.Sprintf("api/v1/dataspaces/%s/files", url.QueryEscape(viewName)), pr, multipartWriter.FormDataContentType())
resp, err = f.client.HTTPRequestContext(ctx, http.MethodPost, fmt.Sprintf("api/v1/dataspaces/%s/files", url.PathEscape(viewName)), pr, multipartWriter.FormDataContentType())
return err
})

Expand Down Expand Up @@ -99,7 +99,7 @@ func (f *Files) Upload(viewName string, fileName string, reader io.Reader) error
}

func (f *Files) Download(viewName string, fileName string) (io.Reader, error) {
resp, err := f.client.HTTPRequest(http.MethodGet, fmt.Sprintf("api/v1/dataspaces/%s/files/%s", url.QueryEscape(viewName), url.QueryEscape(fileName)), nil)
resp, err := f.client.HTTPRequest(http.MethodGet, fmt.Sprintf("api/v1/dataspaces/%s/files/%s", url.PathEscape(viewName), url.PathEscape(fileName)), nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c952a99

Please sign in to comment.