Quote path for /contents API (#614)

This allows spaces and other special characters in the file path.

Fixes #613.
This commit is contained in:
Jason White
2017-11-22 12:57:31 -08:00
committed by GitHub
parent f54b1356fb
commit 554c1ab124
+5 -5
View File
@@ -1252,7 +1252,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
url_parameters["ref"] = ref
headers, data = self._requester.requestJsonAndCheck(
"GET",
self.url + "/contents" + path,
self.url + "/contents" + urllib.quote(path),
parameters=url_parameters
)
if isinstance(data, list):
@@ -1311,7 +1311,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
headers, data = self._requester.requestJsonAndCheck(
"PUT",
self.url + "/contents" + path,
self.url + "/contents" + urllib.quote(path),
input=put_parameters
)
@@ -1370,7 +1370,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
headers, data = self._requester.requestJsonAndCheck(
"PUT",
self.url + "/contents" + path,
self.url + "/contents" + urllib.quote(path),
input=put_parameters
)
@@ -1405,7 +1405,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
headers, data = self._requester.requestJsonAndCheck(
"DELETE",
self.url + "/contents" + path,
self.url + "/contents" + urllib.quote(path),
input=url_parameters
)
@@ -1426,7 +1426,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
url_parameters["ref"] = ref
headers, data = self._requester.requestJsonAndCheck(
"GET",
self.url + "/contents" + path,
self.url + "/contents" + urllib.quote(path),
parameters=url_parameters
)