Skip to content

Commit

Permalink
Merge pull request #611 from versity/ben/iam_s3_nil_map
Browse files Browse the repository at this point in the history
fix: init auth config accounts map
  • Loading branch information
benmcclelland authored Jun 10, 2024
2 parents f6755cb + d5ecb97 commit f110649
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions auth/iam_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func parseIAM(b []byte) (iAMConfig, error) {
return iAMConfig{}, fmt.Errorf("failed to parse the config file: %w", err)
}

if conf.AccessAccounts == nil {
conf.AccessAccounts = make(map[string]Account)
}

return conf, nil
}

Expand Down
4 changes: 2 additions & 2 deletions auth/iam_s3_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ func (s *IAMServiceS3) getAccounts() (iAMConfig, error) {
// init empty accounts stuct and return that
var nsk *types.NoSuchKey
if errors.As(err, &nsk) {
return iAMConfig{}, nil
return iAMConfig{AccessAccounts: map[string]Account{}}, nil
}
var apiErr smithy.APIError
if errors.As(err, &apiErr) {
if apiErr.ErrorCode() == "NotFound" {
return iAMConfig{}, nil
return iAMConfig{AccessAccounts: map[string]Account{}}, nil
}
}

Expand Down

0 comments on commit f110649

Please sign in to comment.