this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

relay: return explicit empty array, not nil, for sync.listRepos (#473)

This is a work-around for the specific situation in:
https://github.com/bluesky-social/atproto/issues/1949

We may need to have lexgen stubs ensure that any required array types in
Output types are set to an explicit empty array, instead of nil? I
haven't dug in to the details of JSON marshaling and CBOR marshaling to
understand the scope of this issue yet, but the root of the issue is
that the typescript code is being more strict about "empty" types than
golang is. The typescript strictness seems both correct and reasonable
to me, FWIW.

authored by

bnewbold and committed by
GitHub
5a20c867 e5eb11e4

+6 -5
+6 -5
bgs/handlers.go
··· 202 202 } 203 203 } 204 204 205 + resp := &comatprototypes.SyncListRepos_Output{ 206 + Repos: []*comatprototypes.SyncListRepos_Repo{}, 207 + } 208 + 205 209 users := []User{} 206 210 if err := s.db.Model(&User{}).Where("id > ? AND NOT tombstoned AND NOT taken_down", c).Order("id").Limit(limit).Find(&users).Error; err != nil { 207 211 if err == gorm.ErrRecordNotFound { ··· 212 216 } 213 217 214 218 if len(users) == 0 { 215 - return &comatprototypes.SyncListRepos_Output{}, nil 216 - } 217 - 218 - resp := &comatprototypes.SyncListRepos_Output{ 219 - Repos: []*comatprototypes.SyncListRepos_Repo{}, 219 + // resp.Repos is an explicit empty array, not just 'nil' 220 + return resp, nil 220 221 } 221 222 222 223 for i := range users {