+6
-7
server/handle_sync_get_blocks.go
+6
-7
server/handle_sync_get_blocks.go
···
2
2
3
3
import (
4
4
"bytes"
5
+
"context"
6
+
"strings"
5
7
6
8
"github.com/bluesky-social/indigo/carstore"
7
9
"github.com/haileyok/cocoon/internal/helpers"
···
12
14
)
13
15
14
16
func (s *Server) handleGetBlocks(e echo.Context) error {
15
-
ctx := e.Request().Context()
16
17
did := e.QueryParam("did")
18
+
cidsstr := e.QueryParam("cids")
17
19
if did == "" {
18
20
return helpers.InputError(e, nil)
19
21
}
20
22
21
-
cidstrs, ok := e.QueryParams()["cids"]
22
-
if !ok {
23
-
return helpers.InputError(e, nil)
24
-
}
25
-
var cids []cid.Cid
23
+
cidstrs := strings.Split(cidsstr, ",")
24
+
cids := []cid.Cid{}
26
25
27
26
for _, cs := range cidstrs {
28
27
c, err := cid.Cast([]byte(cs))
···
57
56
bs := s.getBlockstore(urepo.Repo.Did)
58
57
59
58
for _, c := range cids {
60
-
b, err := bs.Get(ctx, c)
59
+
b, err := bs.Get(context.TODO(), c)
61
60
if err != nil {
62
61
return err
63
62
}