@@ -399,13 +399,17 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [
399399func (o * Object ) createMultipartUpload (ctx context.Context , putReq * objectstorage.PutObjectRequest ) (
400400 uploadID string , existingParts map [int ]objectstorage.MultipartUploadPartSummary , err error ) {
401401 bucketName , bucketPath := o .split ()
402- f := o .fs
403- if f .opt .AttemptResumeUpload {
402+ err = o .fs .makeBucket (ctx , bucketName )
403+ if err != nil {
404+ fs .Errorf (o , "failed to create bucket: %v, err: %v" , bucketName , err )
405+ return uploadID , existingParts , err
406+ }
407+ if o .fs .opt .AttemptResumeUpload {
404408 fs .Debugf (o , "attempting to resume upload for %v (if any)" , o .remote )
405409 resumeUploads , err := o .fs .findLatestMultipartUpload (ctx , bucketName , bucketPath )
406410 if err == nil && len (resumeUploads ) > 0 {
407411 uploadID = * resumeUploads [0 ].UploadId
408- existingParts , err = f .listMultipartUploadParts (ctx , bucketName , bucketPath , uploadID )
412+ existingParts , err = o . fs .listMultipartUploadParts (ctx , bucketName , bucketPath , uploadID )
409413 if err == nil {
410414 fs .Debugf (o , "resuming with existing upload id: %v" , uploadID )
411415 return uploadID , existingParts , err
0 commit comments