From 125b864f150200359af56f4abe77385dc9d0227f Mon Sep 17 00:00:00 2001 From: Hailey Date: Sat, 19 Jul 2025 10:34:36 -0700 Subject: [PATCH] Revert "support multiple cids in getblocks (#23)" This reverts commit 9fbd74c10e490237e8beb34e8e9732843b6bada3. --- server/handle_sync_get_blocks.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server/handle_sync_get_blocks.go b/server/handle_sync_get_blocks.go index e99cc53..2506c19 100644 --- a/server/handle_sync_get_blocks.go +++ b/server/handle_sync_get_blocks.go @@ -2,6 +2,8 @@ package server import ( "bytes" + "context" + "strings" "github.com/bluesky-social/indigo/carstore" "github.com/haileyok/cocoon/internal/helpers" @@ -12,17 +14,14 @@ import ( ) func (s *Server) handleGetBlocks(e echo.Context) error { - ctx := e.Request().Context() did := e.QueryParam("did") + cidsstr := e.QueryParam("cids") if did == "" { return helpers.InputError(e, nil) } - cidstrs, ok := e.QueryParams()["cids"] - if !ok { - return helpers.InputError(e, nil) - } - var cids []cid.Cid + cidstrs := strings.Split(cidsstr, ",") + cids := []cid.Cid{} for _, cs := range cidstrs { c, err := cid.Cast([]byte(cs)) @@ -57,7 +56,7 @@ func (s *Server) handleGetBlocks(e echo.Context) error { bs := s.getBlockstore(urepo.Repo.Did) for _, c := range cids { - b, err := bs.Get(ctx, c) + b, err := bs.Get(context.TODO(), c) if err != nil { return err } -- 2.51.2