mirror of https://github.com/restic/restic.git
s3: Use new API for CopyObject
This commit is contained in:
parent
724b5bf4fe
commit
68a91d66b7
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue