From 68a91d66b76dfc9831b9aae296be65ee2b389c9d Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Mon, 17 Jul 2017 20:43:45 +0200 Subject: [PATCH] s3: Use new API for CopyObject --- src/restic/backend/s3/s3.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/restic/backend/s3/s3.go b/src/restic/backend/s3/s3.go index 950fe3607..989fff104 100644 --- a/src/restic/backend/s3/s3.go +++ b/src/restic/backend/s3/s3.go @@ -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