Skip to content

Fixed repository_tree and repository_blob path encoding #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gitlab/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import itertools
import json
import sys
import urllib
import warnings

import six
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down