2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-07 03:20:49 +00:00

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

View File

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