« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 961 ms

Get rid of all custom URL encoding · Issue #1356 · python-gitlab/python-gitlab

Source: https://github.com/python-gitlab/python-gitlab/issues/1356

Repository navigation

Get rid of all custom URL encoding  #1356


New issue

New issue

Closed
#1816
Closed
Get rid of all custom URL encoding #1356 #1816

Description

@nejch's profile nejch opened on Mar 2, 2021

See also #1336 , #1080 , #1079 .

On the other hand, need to check #1006 and the current state of

python-gitlab/gitlab/client.py

Lines 513 to 524 in 96d2805

# Requests assumes that `.` should not be encoded as %2E and will make
# changes to urls using this encoding. Using a prepped request we can
# get the desired behavior.
# The Requests behavior is right but it seems that web servers don't
# always agree with this decision (this is the case with a default
# gitlab installation)
req = requests . Request ( verb , url , json = json , data = data , params = params , ** opts )
prepped = self . session . prepare_request ( req )
prepped . url = utils . sanitized_url ( prepped . url )
settings = self . session . merge_environment_settings (
prepped . url , {}, streamed , verify , None
)

If proxies handle it differently maybe an additional arg for e.g. encode_xyz=True might help.
gitlab/utils.py:    return id.replace("/", "%2F").replace("#", "%23")
gitlab/utils.py:        return value.replace("/", "%2F")
gitlab/utils.py:    new_path = parsed.path.replace(".", "%2E")
gitlab/v4/objects/branches.py:        id = self.get_id().replace("/", "%2F")
gitlab/v4/objects/branches.py:        id = self.get_id().replace("/", "%2F")
gitlab/v4/objects/features.py:        path = "%s/%s" % (self.path, name.replace("/", "%2F"))
gitlab/v4/objects/files.py:        self.file_path = self.file_path.replace("/", "%2F")
gitlab/v4/objects/files.py:        file_path = self.get_id().replace("/", "%2F")
gitlab/v4/objects/files.py:        file_path = file_path.replace("/", "%2F")
gitlab/v4/objects/files.py:        file_path = new_data.pop("file_path").replace("/", "%2F")
gitlab/v4/objects/files.py:        file_path = file_path.replace("/", "%2F")
gitlab/v4/objects/files.py:        path = "%s/%s" % (self.path, file_path.replace("/", "%2F"))
gitlab/v4/objects/files.py:        file_path = file_path.replace("/", "%2F").replace(".", "%2E")
gitlab/v4/objects/files.py:        file_path = file_path.replace("/", "%2F").replace(".", "%2E")
gitlab/v4/objects/repositories.py:        submodule = submodule.replace("/", "%2F")  # .replace('.', '%2E')
gitlab/v4/objects/tags.py:        id = self.get_id().replace("/", "%2F")
Reacted by Max Wittig, Chris Peterson, John Villalovos and darkdragon-001

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