Skip to content

Commit

Permalink
Fix UploadFileV2 when using text content (#1291)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebmckay authored Jun 6, 2024
1 parent 41fa1e5 commit d959a37
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions files.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,8 @@ func (api *Client) getUploadURLExternal(ctx context.Context, params getUploadURL
func (api *Client) uploadToURL(ctx context.Context, params uploadToURLParameters) (err error) {
values := url.Values{}
if params.Content != "" {
values.Add("content", params.Content)
values.Add("token", api.token)
err = postForm(ctx, api.httpclient, params.UploadURL, values, nil, api)
contentReader := strings.NewReader(params.Content)
err = postWithMultipartResponse(ctx, api.httpclient, params.UploadURL, params.Filename, "file", api.token, values, contentReader, nil, api)
} else if params.File != "" {
err = postLocalWithMultipartResponse(ctx, api.httpclient, params.UploadURL, params.File, "file", api.token, values, nil, api)
} else if params.Reader != nil {
Expand Down

0 comments on commit d959a37

Please sign in to comment.