aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-09-03 10:49:05 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2021-09-03 10:49:05 +0200
commitd38e20337056b05d970b5140335953ca7b15ca8c (patch)
treeb8214a622560b67f57063e6f1ed25817f6444c2b
parente83c3a13b2b8533b7259ffe885bf95d711c3c526 (diff)
downloadbagage-d38e20337056b05d970b5140335953ca7b15ca8c.tar.gz
bagage-d38e20337056b05d970b5140335953ca7b15ca8c.zip
Fix renaming
-rw-r--r--s3_fs.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/s3_fs.go b/s3_fs.go
index f8983ef..e93edb3 100644
--- a/s3_fs.go
+++ b/s3_fs.go
@@ -113,7 +113,6 @@ func (s S3FS) Rename(ctx context.Context, oldName, newName string) error {
//Gather all keys, copy the object, delete the original
objCh := s.mc.ListObjects(s.ctx, po.bucket, minio.ListObjectsOptions{Prefix: po.key, Recursive: true})
for obj := range objCh {
- log.Println("found object", obj)
src := minio.CopySrcOptions{
Bucket: po.bucket,
Object: obj.Key,
@@ -125,16 +124,17 @@ func (s S3FS) Rename(ctx context.Context, oldName, newName string) error {
}
_, err := s.mc.CopyObject(s.ctx, dst, src)
- log.Println("copy", obj)
if err != nil {
- log.Println("copy err", err)
return err
}
- log.Println("delete", obj)
err = s.mc.RemoveObject(s.ctx, po.bucket, obj.Key, minio.RemoveObjectOptions{})
- if err != nil /*&& err.Code != 200*/ /* @FIXME workaround for garage's bug #98 */ {
- log.Println("delete err", err)
+ var e minio.ErrorResponse
+ log.Println(errors.As(err, &e))
+ log.Println(e)
+ if errors.As(err, &e) && e.StatusCode == 200 {
+ /* @FIXME workaround for garage's bug #98 */
+ } else if err != nil {
return err
}
}