mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 04:16:51 +00:00
improve handling of GetAllContentsByRef where root path is requested (#2105)
* add failing test for handling / as the path * workaround issue by passing in what the API expects
This commit is contained in:
@@ -222,6 +222,18 @@ namespace Octokit.Tests.Integration.Clients
|
||||
Assert.Equal(ContentType.Dir, contents.First().Type);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task GetsContentNonMasterWithRootPath()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var contents = await github
|
||||
.Repository
|
||||
.Content
|
||||
.GetAllContentsByRef("octocat", "Spoon-Knife", "/", reference: "test-branch");
|
||||
Assert.Equal(4, contents.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task GetsDirectoryContentWithRepositoryId()
|
||||
{
|
||||
|
||||
@@ -107,7 +107,9 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(path, nameof(path));
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference));
|
||||
|
||||
var url = ApiUrls.RepositoryContent(owner, name, path, reference);
|
||||
var url = (path == "/")
|
||||
? ApiUrls.RepositoryContent(owner, name, "", reference)
|
||||
: ApiUrls.RepositoryContent(owner, name, path, reference);
|
||||
|
||||
return ApiConnection.GetAll<RepositoryContent>(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user