X Tutup
Skip to content

Not escaping strings? #337

@tomascapek

Description

@tomascapek

So I found out, that on some places, strings are not escaped, before they are sent to server.
For example: In my company, we have a policy, which states, that new feature branches, must follow naming scheme feature/{name of the feature}.

Creating branches using this library works as expected, but deletion is a different matter.

So in my script, I call something like this:

gitlab.v4.objects.Project.branches.get('feature/branch_name').delete()

And I got 404:

File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/exceptions.py", line 239, in wrapped_f
 return f(*args, **kwargs)
File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/mixins.py", line 239, in delete
  self.gitlab.http_delete(path, **kwargs)
File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/__init__.py", line 842, in http_delete
  return self.http_request('delete', path, **kwargs)
File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/__init__.py", line 700, in http_request
  response_body=result.content)
gitlab.exceptions.GitlabHttpError: 404: b'{"error":"404 Not Found"}'

So upon a close inspection, it is not surprising. API request was not escaped:

DELETE /api/v4/projects/42/repository/branches/feature/branches HTTP/1.1" 404 None

Can somebody fix this please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup