ValidContents reports whether the hash of blob's content matches its reference.
(ctx context.Context)
| 93 | // ValidContents reports whether the hash of blob's content matches |
| 94 | // its reference. |
| 95 | func (b *Blob) ValidContents(ctx context.Context) error { |
| 96 | mem, err := b.getMem(ctx) |
| 97 | if err != nil { |
| 98 | return err |
| 99 | } |
| 100 | h := b.ref.Hash() |
| 101 | h.Write(mem) |
| 102 | if !b.ref.HashMatches(h) { |
| 103 | return fmt.Errorf("blob contents don't match digest for ref %v", b.ref) |
| 104 | } |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | // IsUTF8 reports whether the blob is entirely UTF-8. |
| 109 | func (b *Blob) IsUTF8(ctx context.Context) (bool, error) { |
nothing calls this directly
no test coverage detected