Skip to content

Commit

Permalink
hotfix: Provide content length on file put (#217)
Browse files Browse the repository at this point in the history
Closes #211
Instead of #212

Signed-off-by: candiduslynx <candiduslynx@gmail.com>
  • Loading branch information
candiduslynx committed Apr 16, 2024
1 parent 42b1542 commit 4f9a1a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,13 @@ func (c *conn) handleStagingPut(ctx context.Context, presignedUrl string, header
}
defer dat.Close()

info, err := dat.Stat()
if err != nil {
return dbsqlerrint.NewDriverError(ctx, "error reading local file info", err)
}

req, _ := http.NewRequest("PUT", presignedUrl, dat)
req.ContentLength = info.Size() // backend actually requires content length to be known

for k, v := range headers {
req.Header.Set(k, v)
Expand Down

0 comments on commit 4f9a1a1

Please sign in to comment.