MCPcopy
hub / github.com/cli/cli / loadContent

Function loadContent

pkg/cmd/repo/read-file/read_file.go:211–222  ·  view source on GitHub ↗

loadContent fetches the raw file bytes when the Contents API did not return them inline. The API only omits inline content for large files, which it marks with a "none" encoding; everything else (including empty files) comes back base64-encoded, so there is nothing to fetch.

(httpClient *http.Client, repo ghrepo.Interface, file *repoFile, ref string)

Source from the content-addressed store, hash-verified

209// The API only omits inline content for large files, which it marks with a "none" encoding;
210// everything else (including empty files) comes back base64-encoded, so there is nothing to fetch.
211func loadContent(httpClient *http.Client, repo ghrepo.Interface, file *repoFile, ref string) error {
212 if file.Encoding != "none" {
213 return nil
214 }
215
216 raw, err := fetchRawFile(httpClient, repo, file.Path, ref)
217 if err != nil {
218 return err
219 }
220 file.Content = raw
221 return nil
222}
223
224// lstatResult captures the subset of output-path information the command needs,
225// determined without following a symlink at the path.

Callers 1

readFileRunFunction · 0.85

Calls 1

fetchRawFileFunction · 0.85

Tested by

no test coverage detected