← Winnitude! Search  ·  Reader Mode (265 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 13 LINKS

Tries to perform "utf8" decoding when encoding set to "base64" on file commit · Issue #427 · python-gitlab/python-gitlab

Repository navigation

Tries to perform "utf8" decoding when encoding set to "base64" on file commit  #427


New issue

New issue

Closed

Closed
Tries to perform "utf8" decoding when encoding set to "base64" on file commit #427 Labels
docs

enhancement
Milestone v1.4

Description

@JonBoyleCoding's profile JonBoyleCoding opened on Feb 5, 2018

When I'm trying to commit a binary file into a repository and setting the encoding to "base64" (as specified in https://docs.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository ), I'm getting the following error:

Traceback (most recent call last):
File "create_submission_point_for_group.py", line 261, in
project.files.create(blob)
File "/usr/local/lib/python2.7/dist-packages/gitlab/cli.py", line 42, in wrapped_f
return f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/gitlab/exceptions.py", line 247, in wrapped_f
return f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/gitlab/v4/objects.py", line 1806, in create
server_data = self.gitlab.http_post(path, post_data=new_data, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/gitlab/ init .py", line 792, in http_post
post_data=post_data, files=files, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/gitlab/ init .py", line 678, in http_request
prepped = self.session.prepare_request(req)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 394, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 298, in prepare
self.prepare_body(data, files, json)
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 424, in prepare_body
body = complexjson.dumps(json)
File "/usr/lib/python2.7/dist-packages/simplejson/ init .py", line 380, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 291, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 373, in iterencode
return _iterencode(o, 0)

This makes it seem like the python api is ignoring the encoding option. I've ensured the encoding is set to base64 in the 'blob' that I've passed to project.files.create(). Other ordinary files without the encoding commit perfectly fine.

Metadata

Metadata

Assignees

No one assigned

    Labels


    docs

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions