Handle a path of / in Repository.get_contents() (#1070)

The path requested in Repository.get_contents() is appended to the URL,
so the root path should be requested with the empty string. If path is
'/', set it to the empty string. Copy the replay data from the original
test, since it is identical.

Drive-by renaming the test to include the missing 's'.

Closes #1059
This commit is contained in:
Steve Kowalik
2019-05-22 15:10:27 +08:00
committed by Wan Liuyang
parent 3d43e9c0e6
commit 102c820806
4 changed files with 20 additions and 2 deletions
+3
View File
@@ -1478,6 +1478,9 @@ class Repository(github.GithubObject.CompletableGithubObject):
"""
assert isinstance(path, (str, unicode)), path
assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
# Path of '/' should be the empty string.
if path == '/':
path = ''
url_parameters = dict()
if ref is not github.GithubObject.NotSet:
url_parameters["ref"] = ref