Retrieves a non-winning revision body. If not already loaded in the document (either because inline, or was previously requested), loader function is used to retrieve from the bucket.
(ctx context.Context, revid string, loader RevLoaderFunc)
| 778 | // Retrieves a non-winning revision body. If not already loaded in the document (either because inline, |
| 779 | // or was previously requested), loader function is used to retrieve from the bucket. |
| 780 | func (doc *Document) getNonWinningRevisionBody(ctx context.Context, revid string, loader RevLoaderFunc) Body { |
| 781 | var body Body |
| 782 | bodyBytes, found := doc.History.getRevisionBody(revid, loader) |
| 783 | if !found || len(bodyBytes) == 0 { |
| 784 | return nil |
| 785 | } |
| 786 | |
| 787 | if err := body.Unmarshal(bodyBytes); err != nil { |
| 788 | base.WarnfCtx(ctx, "Unexpected error parsing body of rev %q: %v", revid, err) |
| 789 | return nil |
| 790 | } |
| 791 | return body |
| 792 | } |
| 793 | |
| 794 | // Fetches the body of a revision as JSON, or nil if it's not available. |
| 795 | func (doc *Document) getRevisionBodyJSON(ctx context.Context, revid string, loader RevLoaderFunc) []byte { |
no test coverage detected