diff --git a/pkg/hold/pds/xrpc.go b/pkg/hold/pds/xrpc.go index ceeb8b9..b34387f 100644 --- a/pkg/hold/pds/xrpc.go +++ b/pkg/hold/pds/xrpc.go @@ -303,7 +303,7 @@ func (h *XRPCHandler) HandleSyncGetRecord(w http.ResponseWriter, r *http.Request path := fmt.Sprintf("%s/%s", collection, rkey) // Get the record (this will log all accessed blocks in the MST path) - recordCID, _, err := tempRepo.GetRecordBytes(r.Context(), path) + _, _, err = tempRepo.GetRecordBytes(r.Context(), path) if err != nil { http.Error(w, fmt.Sprintf("failed to get record: %v", err), http.StatusNotFound) return @@ -312,21 +312,16 @@ func (h *XRPCHandler) HandleSyncGetRecord(w http.ResponseWriter, r *http.Request // Get all blocks that were accessed during record retrieval blocks := loggingBS.GetLoggedBlocks() - // Log block count for debugging - fmt.Printf("sync.getRecord: Retrieved %d blocks for record at %s/%s\n", len(blocks), collection, rkey) - for i, blk := range blocks { - fmt.Printf(" Block %d: CID=%s, size=%d bytes\n", i+1, blk.Cid().String(), len(blk.RawData())) - } - // Write CAR file with all accessed blocks w.Header().Set("Content-Type", "application/vnd.ipld.car") // Create a buffer to write the CAR data var buf bytes.Buffer - // Create CAR header with the record CID as root + // Create CAR header with the repo head as root (not the record CID) + // The CAR file represents a slice of the repo from head to record header := &car.CarHeader{ - Roots: []cid.Cid{recordCID}, + Roots: []cid.Cid{repoHead}, Version: 1, }