From 5b3192344dbf53c5f6f281797c1d32b367844b4d Mon Sep 17 00:00:00 2001 From: guosj <515878133@qq.com> Date: Fri, 8 Jul 2022 17:42:21 +0800 Subject: [PATCH] fix iam CreatePolicy error --- weed/iamapi/iamapi_server.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/weed/iamapi/iamapi_server.go b/weed/iamapi/iamapi_server.go index 62c7f867c..252d5bd0e 100644 --- a/weed/iamapi/iamapi_server.go +++ b/weed/iamapi/iamapi_server.go @@ -6,6 +6,8 @@ import ( "bytes" "encoding/json" "fmt" + "net/http" + "github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" @@ -17,7 +19,6 @@ import ( "github.com/chrislusf/seaweedfs/weed/wdclient" "github.com/gorilla/mux" "google.golang.org/grpc" - "net/http" ) type IamS3ApiConfig interface { @@ -117,10 +118,10 @@ func (iam IamS3ApiConfigure) GetPolicies(policies *Policies) (err error) { } return nil }) - if err != nil { + if err != nil && err != filer_pb.ErrNotFound { return err } - if buf.Len() == 0 { + if err == filer_pb.ErrNotFound || buf.Len() == 0 { policies.Policies = make(map[string]PolicyDocument) return nil }