-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client.Repository.Content.GetAllContents for root not currently possible. #800
Comments
I am able to get the contents of a repository's root directory by passing in "/" as the path, but I am unsure if this is due to changes made after this issue was opened. |
👍 "/" only works if you're retrieving master branch. If you're retrieving some other branch it defaults to master branch, because the generated url is actually invalid: "contents//?ref=branch-name". Remove the check for empty string when specifying path. |
You could get all the contents of the branch using the overload I am able to get all the contents of the branch and master including the sub-directories. Here is a sample.
|
I have 7 files on my master branch, and 6 on my custom branch ("ostruk-branch" does not have "added.js"). When I call
I get 7 files, same as if I called without "ostruk-branch". When I inspect the code, I can see it attempts to make a call to https://api.github.com/repos/UW-demo/multiJs/contents//?ref=ostruk-branch where you can see that all files have "?ref=master" by them, indicating they are being pulled from the master branch. If I change the url to https://api.github.com/repos/UW-demo/multiJs/contents/?ref=ostruk-branch , which is equivalent to passing "'" for path argument, then response is correct. I'm using 0.16.0. Thanks! |
@ostruk Yes you are right. It is a bug. |
… not currently possible. octokit#800 The client.Repository.Content.GetAllContents does not allow null in the `path` argument. With the branch the root was always returning the `master` instead of the reference passed in the argument.
…ntly possible. octokit#800 The code client.Repository.Content.GetAllContents didn't allow getting the root directory contents when there was a branch in the `ref` parameter. This fix would disallow the null check for the path to get by this.
…ly possible. octokit#800 The client.Repository.Content.GetAllContents does not allow getting root folders for Branches. This fix would allow the users to pass null/empty strings for the path which will address the issue.
…ly possible. #800 The client.Repository.Content.GetAllContents does not allow getting root folders for Branches. This fix would allow the users to pass null/empty strings for the path which will address the issue.
Can we reopen this issue? The fix was accidentally undone during #1348 and I'm running into it again. |
Whoops! Need to dig into this to see why there isn't an integration test that failed |
@jamesqo just looking at this one... are you referring to the fact that If that's the case can't you just call |
👋 Hey Friends, this issue has been automatically marked as |
Task<IReadOnlyList> GetAllContents(string owner, string name, string path);
Will currently only work with subdirectories ie:
client.Repository.Content.GetAllContents("octokit", "octokit.net", "Octokit")
returns 18 items.However
client.Repository.Content.GetAllContents("octokit", "octokit.net", "")
Throws a ArgumentException("String cannot be empty", name)For a quick fixed I hacked GetAllContents as follows locally but a better option is probably needed.
The text was updated successfully, but these errors were encountered: