storj: fix bucket creation on Move picked up by integration tests

This commit is contained in:
Nick Craig-Wood 2022-04-15 17:35:50 +01:00
parent 7c31240bb8
commit 6a759d936a

View File

@ -705,7 +705,16 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
// Do the move // Do the move
err := f.project.MoveObject(ctx, srcBucket, srcKey, dstBucket, dstKey, &options) err := f.project.MoveObject(ctx, srcBucket, srcKey, dstBucket, dstKey, &options)
if err != nil { if err != nil {
return nil, fmt.Errorf("rename object failed: %w", err) // Make sure destination bucket exists
_, err := f.project.EnsureBucket(ctx, dstBucket)
if err != nil {
return nil, fmt.Errorf("rename object failed to create destination bucket: %w", err)
}
// And try again
err = f.project.MoveObject(ctx, srcBucket, srcKey, dstBucket, dstKey, &options)
if err != nil {
return nil, fmt.Errorf("rename object failed: %w", err)
}
} }
// Read the new object // Read the new object