From 923ea3268193369a427984494ceb213b47e8246e Mon Sep 17 00:00:00 2001 From: Yosi Date: Sat, 20 May 2017 11:51:59 +0300 Subject: [PATCH 1/2] fixed repository_tree and repository_blob path encoding --- gitlab/objects.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitlab/objects.py b/gitlab/objects.py index 58eb867ed..7999adbe0 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -24,6 +24,7 @@ import json import sys import warnings +import urllib import six @@ -2348,7 +2349,7 @@ def repository_tree(self, path='', ref_name='', **kwargs): url = "/projects/%s/repository/tree" % (self.id) params = [] if path: - params.append("path=%s" % path) + params.append(urllib.urlencode({'path' : path})) if ref_name: params.append("ref_name=%s" % ref_name) if params: @@ -2379,7 +2380,7 @@ def repository_blob(self, sha, filepath, streamed=False, action=None, GitlabGetError: If the server fails to perform the request. """ url = "/projects/%s/repository/blobs/%s" % (self.id, sha) - url += '?filepath=%s' % (filepath) + url += '?%s' % (urllib.urlencode({'filepath' : filepath})) r = self.gitlab._raw_get(url, streamed=streamed, **kwargs) raise_error_from_response(r, GitlabGetError) return utils.response_content(r, streamed, action, chunk_size) From 110676e4e914e1a5a7764784edc32ce2edf58767 Mon Sep 17 00:00:00 2001 From: Yosi Date: Sat, 20 May 2017 11:58:48 +0300 Subject: [PATCH 2/2] fixed pep8 warnings --- gitlab/objects.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitlab/objects.py b/gitlab/objects.py index 7999adbe0..0c3d30dbd 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -23,8 +23,8 @@ import itertools import json import sys -import warnings import urllib +import warnings import six @@ -2349,7 +2349,7 @@ def repository_tree(self, path='', ref_name='', **kwargs): url = "/projects/%s/repository/tree" % (self.id) params = [] if path: - params.append(urllib.urlencode({'path' : path})) + params.append(urllib.urlencode({'path': path})) if ref_name: params.append("ref_name=%s" % ref_name) if params: @@ -2380,7 +2380,7 @@ def repository_blob(self, sha, filepath, streamed=False, action=None, GitlabGetError: If the server fails to perform the request. """ url = "/projects/%s/repository/blobs/%s" % (self.id, sha) - url += '?%s' % (urllib.urlencode({'filepath' : filepath})) + url += '?%s' % (urllib.urlencode({'filepath': filepath})) r = self.gitlab._raw_get(url, streamed=streamed, **kwargs) raise_error_from_response(r, GitlabGetError) return utils.response_content(r, streamed, action, chunk_size)