Skip to content

Commit 74b48a1

Browse files
authored
fix: Improve app list loading by switching to JSON decoder from file stream (#11095)
1 parent 42f61f6 commit 74b48a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

agent/app/service/app.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,13 +862,15 @@ func getAppList() (*dto.AppList, error) {
862862
return nil, err
863863
}
864864
listFile := filepath.Join(global.Dir.ResourceDir, "1panel.json")
865-
content, err := os.ReadFile(listFile)
865+
file, err := os.Open(listFile)
866866
if err != nil {
867867
return nil, err
868868
}
869-
if err = json.Unmarshal(content, list); err != nil {
869+
defer file.Close()
870+
if err = json.NewDecoder(file).Decode(list); err != nil {
870871
return nil, err
871872
}
873+
872874
return list, nil
873875
}
874876

0 commit comments

Comments
 (0)