Skip to content

Commit

Permalink
fix: 返回object默认acl
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu Xuan committed Jun 5, 2020
1 parent 0f9df3e commit 510eb10
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/multicloud/objectstore/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ func (o *SObject) GetIBucket() cloudprovider.ICloudBucket {
func (o *SObject) GetAcl() cloudprovider.TBucketACLType {
acl, err := o.bucket.client.GetObjectAcl(o.bucket.Name, o.Key)
if err != nil {
if e, ok := errors.Cause(err).(s3cli.ErrorResponse); ok {
if e.Code == "NoSuchKey" || e.Message == "The specified key does not exist." {
objects, _ := o.bucket.ListObjects(o.Key, "", "", 1)
if len(objects.Objects) > 0 {
return cloudprovider.ACLPrivate
}
}
}
log.Errorf("o.bucket.client.GetObjectAcl error %s", err)
return acl
}
Expand Down

0 comments on commit 510eb10

Please sign in to comment.