From 554c1ab124e4fcc044a8a5485cbcf962ee305ab2 Mon Sep 17 00:00:00 2001 From: Jason White Date: Wed, 22 Nov 2017 12:57:31 -0800 Subject: [PATCH] Quote path for /contents API (#614) This allows spaces and other special characters in the file path. Fixes #613. --- github/Repository.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/github/Repository.py b/github/Repository.py index 5ae3d975..0f13f0ee 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -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 )