mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 06:46:34 +00:00
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)
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user