mirror of
https://github.com/rclone/rclone.git
synced 2025-08-10 06:07:46 +02:00
lib/rest: fix multipart uploads stopping on context cancel
Before this change when the context was cancelled (due to --max-duration for example) this could deadlock when uploading multipart uploads. This change fixes the problem by introducing another go routine to monitor the context and close the pipe with an error when the context errors.
This commit is contained in:
@ -1137,7 +1137,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
// opts.Body=0), so upload it as a multipart form POST with
|
||||
// Content-Length set.
|
||||
if size == 0 {
|
||||
formReader, contentType, overhead, err := rest.MultipartUpload(in, opts.Parameters, "content", leaf)
|
||||
formReader, contentType, overhead, err := rest.MultipartUpload(ctx, in, opts.Parameters, "content", leaf)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to make multipart upload for 0 length file")
|
||||
}
|
||||
|
Reference in New Issue
Block a user