Return error when peer is not valid (#1573)

Fix count with invalid peers
This commit is contained in:
Maycon Santos
2024-02-13 10:59:31 +01:00
committed by GitHub
parent dd14db6478
commit e890fdae54
2 changed files with 13 additions and 4 deletions

View File

@ -240,10 +240,9 @@ func (h *GroupsHandler) GetGroup(w http.ResponseWriter, r *http.Request) {
func toGroupResponse(account *server.Account, group *server.Group) *api.Group {
cache := make(map[string]api.PeerMinimum)
gr := api.Group{
Id: group.ID,
Name: group.Name,
PeersCount: len(group.Peers),
Issued: &group.Issued,
Id: group.ID,
Name: group.Name,
Issued: &group.Issued,
}
for _, pid := range group.Peers {
@ -261,5 +260,8 @@ func toGroupResponse(account *server.Account, group *server.Group) *api.Group {
gr.Peers = append(gr.Peers, peerResp)
}
}
gr.PeersCount = len(gr.Peers)
return &gr
}