Repository navigation
RFE: We should catch all 301, 302 redirects #1485
New issue
New issue
Closed
#1486
Closed
RFE: We should catch all 301, 302 redirects #1485
#1486
Assignees
JohnVillalovos is assigned max-wittig is assigned nejch is assigned
Description
@JohnVillalovos's profile
JohnVillalovos
opened
on May 30, 2021
Currently we raise an error if there is a 301, 302 redirect from an http URL to an httpS URL for any non GET methods.
But we don't raise an error for any other redirects.
This causes two problems:
PUT requests that are redirected get changed to GET requests which don't perform the correct action but raise no error. This is because the GET response succeeds but since it wasn't a PUT it doesn't update. This can be seen by updating a user status. It raises no errors but the status does not change. See issue Changing milestone of issue does not work #1432
POST requests blow up with hard to debug tracebacks. See below. Also see issue Not possible to create note in issue #1477
An example of attempting to upload an SSH key on a URL that redirects with 302 for the POST request:
Traceback (most recent call last):
File "/home/jlvillal/.local/lib/python3.9/site-packages/gitlab/base.py", line 77, in __getattr__
return self.__dict__["_updated_attrs"][name]
KeyError: '_managers'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jlvillal/sources/local/py-gitlab-testing/./tt.py", line 109, in <module>
sys.exit(main())
File "/home/jlvillal/sources/local/py-gitlab-testing/./tt.py", line 82, in main
k = user.keys.create({"title": "My key", "key": SSH_KEY})
File "/home/jlvillal/.local/lib/python3.9/site-packages/gitlab/exceptions.py", line 287, in wrapped_f
return f(*args, **kwargs)
File "/home/jlvillal/.local/lib/python3.9/site-packages/gitlab/mixins.py", line 325, in create
return self._obj_cls(self, server_data)
File "/home/jlvillal/.local/lib/python3.9/site-packages/gitlab/base.py", line 62, in __init__
self._create_managers()
File "/home/jlvillal/.local/lib/python3.9/site-packages/gitlab/base.py", line 145, in _create_managers
managers = getattr(self, "_managers", None)
File "/home/jlvillal/.local/lib/python3.9/site-packages/gitlab/base.py", line 80, in __getattr__
value = self.__dict__["_attrs"][name]
TypeError: list indices must be integers or slices, not str
Metadata
Metadata
Assignees
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