Description
GitHub Apps have the ability to request access to individual files which is great for fine-grained access.
However, as of v47.1.0
, this will prevent someone from being able to download a file from the root repository because of the way DownloadContents
implements directory scanning first:
go-github/github/repos_contents.go
Lines 129 to 134 in 8a4bdb5
The first thing that the function does is get just the directory name with path.Dir
but if you try to download a file like just CODEOWNERS
which is a valid location for a CODEOWNERS
file, then the first request to the API will create a URL like so:
https://api.github.com/repos/$owner/$repo/contents/
At the moment, there's no way to add the root directory to the list of single file paths. You cannot add a blank path and adding just /
doesn't work either.