Skip to content

Commit

Permalink
修正自定义parse内容为空 (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengqi committed Dec 11, 2022
1 parent 6f65a18 commit 734a8a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion component/remote/async.go
Expand Up @@ -175,7 +175,12 @@ func createApolloConfigWithJSON(b []byte, callback http.CallBack) (o interface{}
if parser == nil {
return apolloConfig, nil
}
m, err := parser.Parse(apolloConfig.Configurations[defaultContentKey])

content, ok := apolloConfig.Configurations[defaultContentKey]
if !ok {
content = string(b)
}
m, err := parser.Parse(content)
if err != nil {
log.Debugf("GetContent fail ! error: %v", err)
}
Expand Down
7 changes: 6 additions & 1 deletion component/remote/sync.go
Expand Up @@ -83,7 +83,12 @@ func processJSONFiles(b []byte, callback http.CallBack) (o interface{}, err erro
if parser == nil {
return apolloConfig, nil
}
m, err := parser.Parse(configurations[defaultContentKey])

content, ok := configurations[defaultContentKey]
if !ok {
content = string(b)
}
m, err := parser.Parse(content)
if err != nil {
log.Debugf("GetContent fail ! error: %v", err)
}
Expand Down

0 comments on commit 734a8a5

Please sign in to comment.