···7788 "github.com/ipfs/go-cid"
99 "pkg.rbrt.fr/vow/internal/helpers"
1010+ "pkg.rbrt.fr/vow/models"
1011)
11121213func (s *Server) handleSyncGetBlob(w http.ResponseWriter, r *http.Request) {
···47484849 // Verify this blob is registered to the given DID. We don't store the
4950 // blob bytes here — just the metadata row that proves ownership.
5050- var count int64
5151- if err := s.db.Raw(ctx, "SELECT COUNT(*) FROM blobs WHERE did = ? AND cid = ?", nil, did, c.Bytes()).Scan(&count).Error; err != nil {
5151+ var blob models.Blob
5252+ if err := s.db.Raw(ctx, "SELECT * FROM blobs WHERE did = ? AND cid = ?", nil, did, c.Bytes()).Scan(&blob).Error; err != nil {
5253 logger.Error("error looking up blob", "error", err)
5354 helpers.ServerError(w, nil)
5455 return
5556 }
5656- if count == 0 {
5757+ if blob.Did == "" {
5758 helpers.InputError(w, new("BlobNotFound"))
5859 return
5960 }
···9495 }
95969697 w.Header().Set("Content-Disposition", "attachment; filename="+c.String())
9797- w.Header().Set("Content-Type", "application/octet-stream")
9898+ w.Header().Set("Content-Type", blob.MimeType)
9899 w.WriteHeader(http.StatusOK)
99100 if _, err := io.Copy(w, resp.Body); err != nil {
100101 logger.Error("failed to stream blob response", "error", err)
-7
server/ipfs.go
···2233import (
44 "context"
55- "encoding/json"
66- "io"
7586 "github.com/ipfs/boxo/path"
97 "github.com/ipfs/go-cid"
108 caopts "github.com/ipfs/kubo/core/coreiface/options"
119)
1212-1313-// readJSON decodes a single JSON value from r into dst.
1414-func readJSON(r io.Reader, dst any) error {
1515- return json.NewDecoder(r).Decode(dst)
1616-}
17101811// unpinFromIPFS asks the local Kubo node to remove the recursive pin for the
1912// given CID so the content becomes eligible for garbage collection.
+2
server/repo.go
···350350// or an error occurs. Standard ATProto clients see a normal (slightly slower)
351351// response; the signing round-trip is invisible to them.
352352func (rm *RepoMan) applyWrites(ctx context.Context, urepo models.Repo, writes []Op, swapCommit *string) ([]ApplyWriteResult, error) {
353353+ _ = swapCommit // TODO: eventually use this.
354354+353355 rootcid, err := cid.Cast(urepo.Root)
354356 if err != nil {
355357 return nil, err