mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-06-08 08:12:35 +00:00
need repohead
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user