Skip to content

Commit f3dfa6a

Browse files
yosizelenskyGauvain Pocentek
authored and
Gauvain Pocentek
committed
Fixed repository_tree and repository_blob path encoding (#265)
1 parent 324f81b commit f3dfa6a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gitlab/objects.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import itertools
2424
import json
2525
import sys
26+
import urllib
2627
import warnings
2728

2829
import six
@@ -2348,7 +2349,7 @@ def repository_tree(self, path='', ref_name='', **kwargs):
23482349
url = "/projects/%s/repository/tree" % (self.id)
23492350
params = []
23502351
if path:
2351-
params.append("path=%s" % path)
2352+
params.append(urllib.urlencode({'path': path}))
23522353
if ref_name:
23532354
params.append("ref_name=%s" % ref_name)
23542355
if params:
@@ -2379,7 +2380,7 @@ def repository_blob(self, sha, filepath, streamed=False, action=None,
23792380
GitlabGetError: If the server fails to perform the request.
23802381
"""
23812382
url = "/projects/%s/repository/blobs/%s" % (self.id, sha)
2382-
url += '?filepath=%s' % (filepath)
2383+
url += '?%s' % (urllib.urlencode({'filepath': filepath}))
23832384
r = self.gitlab._raw_get(url, streamed=streamed, **kwargs)
23842385
raise_error_from_response(r, GitlabGetError)
23852386
return utils.response_content(r, streamed, action, chunk_size)

0 commit comments

Comments
 (0)