Description
I think this has been broken since we introduced the appconfig
package, but it's also possible that GitHub's API changed. The GetContents
method returns content if the file is less than 1MB and an empty content
field in the JSON for content between 1MB and 100MB. The endpoint returns an error for content over 100MB.
We handle the case where the content is larger than 100MB, but do not handle the case where the content is larger than 1MB. Instead, we return an error when we try to decode content with the none
encoding.
When the content field is empty, I think there are two options:
- Make another request to the "Get repository contents" API, but provide the
raw
media type - Switch to using the
DownloadContents
method, like we do when the file is larger than 100MB
The reason to not use DownloadContents
every time is that it makes two API calls: one to list the directory containing the file, and then one to download the file. Since most apps perform configuration lookups all the time, minimizing requests here is a good idea.