s3: Use new API for CopyObject

This commit is contained in:
Alexander Neumann 2017-07-17 20:43:45 +02:00
parent 724b5bf4fe
commit 68a91d66b7
1 changed files with 8 additions and 2 deletions

View File

@ -479,8 +479,14 @@ func (be *Backend) Rename(h restic.Handle, l backend.Layout) error {
debug.Log(" %v -> %v", oldname, newname) debug.Log(" %v -> %v", oldname, newname)
coreClient := minio.Core{Client: be.client} src := minio.NewSourceInfo(be.cfg.Bucket, oldname, nil)
err := coreClient.CopyObject(be.cfg.Bucket, newname, path.Join(be.cfg.Bucket, oldname), minio.CopyConditions{})
dst, err := minio.NewDestinationInfo(be.cfg.Bucket, newname, nil, nil)
if err != nil {
return errors.Wrap(err, "NewDestinationInfo")
}
err = be.client.CopyObject(dst, src)
if err != nil && be.IsNotExist(err) { if err != nil && be.IsNotExist(err) {
debug.Log("copy failed: %v, seems to already have been renamed", err) debug.Log("copy failed: %v, seems to already have been renamed", err)
return nil return nil