BYOK Personal Data Server (PDS) written in Go
ipfs vow atproto pds go
0
fork

Configure Feed

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

fix: Handle edge cases in applyWrites and blob parsing

+24
+24
server/repo.go
··· 447 447 }) 448 448 449 449 case OpTypeDelete: 450 + existing, _ := r.MST.Get([]byte(path)) 451 + if existing == nil { 452 + results = append(results, ApplyWriteResult{ 453 + Type: new(OpTypeDelete.String()), 454 + }) 455 + continue 456 + } 457 + 450 458 var old models.Record 451 459 if err := rm.db.Raw(ctx, "SELECT value FROM records WHERE did = ? AND nsid = ? AND rkey = ?", nil, urepo.Did, op.Collection, op.Rkey).Scan(&old).Error; err != nil { 452 460 return cid.Undef, err ··· 528 536 return cid.Undef, nil 529 537 }); err != nil { 530 538 return nil, err 539 + } 540 + 541 + if len(atpOps) == 0 { 542 + for i := range results { 543 + rt := *results[i].Type + "Result" 544 + results[i].Type = &rt 545 + results[i].Commit = &RepoCommit{ 546 + Cid: rootcid.String(), 547 + Rev: urepo.Rev, 548 + } 549 + } 550 + return results, nil 531 551 } 532 552 533 553 // ── Phase 2: serialise the write log so we can replay it ───────────── ··· 939 959 // to be honest, we could just store both the cbor and non-cbor in []entries above to avoid an additional 940 960 // unmarshal here. this will work for now though 941 961 func getBlobCidsFromCbor(cbor []byte) ([]cid.Cid, error) { 962 + if len(cbor) == 0 { 963 + return nil, nil 964 + } 965 + 942 966 var cids []cid.Cid 943 967 944 968 decoded, err := atdata.UnmarshalCBOR(cbor)