FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Suggestion: url encode project paths automatically · Issue #1498 · python-gitlab/python-gitlab · GitHub

Repository navigation

Suggestion: url encode project paths automatically #1498

Description

Description of the problem, including code/CLI snippet

Would be nice to not have to url-encode project paths when calling project APIs. Feels pretty safe to replace / with %2F and not break folks

Expected Behavior

Allow project paths to contain / without any escaping/encoding

Actual Behavior

Results in 404s, project not found. have to url encode and try again.

Specifications

  • python-gitlab version: 2.7.1
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 13.10.3

Activity

  1. nejch commented on Jun 3, 2021

    Member

    Hi @chris-peterson thanks, can you give some examples of endpoints that don't allow project paths to have /?

    Things like gl.projects.get("path/to/project") should already work. Or did I misunderstand the issue? :)

  2. chris-peterson commented on Jun 3, 2021

    Author

    @nejch -- I am grateful that the get function will accept non-encoded project ids. the suggestion is for other APIs, e.g. updating a project. here's an example:

    works:
    gitlab project update --id 'mygroup%2Fmyproject' --tag-list 'some value'

    fails:
    gitlab project update --id 'mygroup/myproject' --tag-list 'some value'

    my workaround so far has been to either:

    1. url encode project ids before calling APIs OR
    2. always look up the integer ID first and pass that instead
  3. nejch commented on Jun 3, 2021

    Member

    Thanks! I see, so this is mostly an issue with the CLI as with the API you would usually first get the object (even if lazily), but we should update this, it should be a few one-liners. Thanks for the report!

    Related to #1356

  4. added 3 commits that reference this issue on Jan 8, 2022
    4b779bd
    79b1cc0
    ac1c619
  5. locked as resolved and limited conversation to collaborators on Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL