summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2019-01-19 09:13:58 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2019-01-19 09:13:58 +0100
commit35a6d85acea4776e9c4ad23ff75259481a6bcf8d (patch)
tree7205ff40b422e22fb91bdb3fcf3301b3877dd46a /gitlab/v4/objects.py
parent89679ce5ee502e57dbe7cec2b78f4f70b85fd3a5 (diff)
downloadgitlab-35a6d85acea4776e9c4ad23ff75259481a6bcf8d.tar.gz
fix(api): Don't try to parse raw downloadsfix/683/raw_download
http_get always tries to interpret the retrieved data if the content-type is json. In some cases (artifact download for instance) this is not the expected behavior. This patch changes http_get and download methods to always get the raw data without parsing. Closes #683
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r--gitlab/v4/objects.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index fd673b5..c3714d8 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -1128,7 +1128,7 @@ class Snippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
"""
path = '/snippets/%s/raw' % self.get_id()
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@@ -1365,7 +1365,7 @@ class ProjectJob(RESTObject, RefreshMixin):
"""
path = '%s/%s/artifacts' % (self.manager.path, self.get_id())
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@cli.register_custom_action('ProjectJob')
@@ -1393,7 +1393,7 @@ class ProjectJob(RESTObject, RefreshMixin):
"""
path = '%s/%s/artifacts/%s' % (self.manager.path, self.get_id(), path)
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@cli.register_custom_action('ProjectJob')
@@ -1419,7 +1419,7 @@ class ProjectJob(RESTObject, RefreshMixin):
"""
path = '%s/%s/trace' % (self.manager.path, self.get_id())
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@@ -2654,7 +2654,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin,
path = '%s/%s/raw' % (self.path, file_path)
query_data = {'ref': ref}
result = self.gitlab.http_get(path, query_data=query_data,
- streamed=streamed, **kwargs)
+ streamed=streamed, raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@@ -2897,7 +2897,7 @@ class ProjectSnippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin,
"""
path = "%s/%s/raw" % (self.manager.path, self.get_id())
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@@ -3174,7 +3174,7 @@ class ProjectExport(RefreshMixin, RESTObject):
"""
path = '/projects/%d/export/download' % self.project_id
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@@ -3315,7 +3315,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
"""
path = '/projects/%s/repository/blobs/%s/raw' % (self.get_id(), sha)
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@cli.register_custom_action('Project', ('from_', 'to'))
@@ -3391,7 +3391,8 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
if sha:
query_data['sha'] = sha
result = self.manager.gitlab.http_get(path, query_data=query_data,
- streamed=streamed, **kwargs)
+ raw=True, streamed=streamed,
+ **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@cli.register_custom_action('Project', ('forked_from_id', ))
@@ -3674,7 +3675,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
"""
path = '/projects/%d/snapshot' % self.get_id()
result = self.manager.gitlab.http_get(path, streamed=streamed,
- **kwargs)
+ raw=True, **kwargs)
return utils.response_content(result, streamed, action, chunk_size)
@cli.register_custom_action('Project', ('scope', 'search'))