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

fix: raise error if there is a 301/302 redirection by JohnVillalovos · Pull Request #1486 · python-gitlab/python-gitlab

Source: https://github.com/python-gitlab/python-gitlab/pull/1486

Repository navigation

fix: raise error if there is a 301/302 redirection - #1486


Merged
nejch merged 1 commit into python-gitlab:master from JohnVillalovos:jlvillal/prohibit_redirection Sep 8, 2021
Merged

fix: raise error if there is a 301/302 redirection #1486 nejch merged 1 commit into python-gitlab:master from JohnVillalovos:jlvillal/prohibit_redirection

Conversation

JohnVillalovos commented May 30, 2021 · edited Loading



Copy link Copy Markdown
Member

Before we raised an error if there was a 301, 302 redirect but only
from an http URL to an https URL. But we didn't raise an error for
any other redirects.

This caused two problems:

  1. PUT requests that are redirected get changed to GET requests
    which don't perform the desired action but raise no error. This
    is because the GET response succeeds but since it wasn't a PUT it
    doesn't update. See issue:
    Changing milestone of issue does not work  #1432
  2. POST requests that are redirected also got changed to GET
    requests. They also caused hard to debug tracebacks for the user.
    See issue:
    Not possible to create note in issue  #1477

Correct this by always raising a RedirectError exception and improve
the exception message to let them know what was redirected.

Closes : #1485
Closes : #1432
Closes : #1477

codecov-commenter commented May 30, 2021 · edited Loading



Copy link Copy Markdown

Codecov Report

Merging #1486 (638b269 ) into master (b8a47ba ) will decrease coverage by 8.52%.
The diff coverage is 88.88%.

@@            Coverage Diff             @@
##           master    #1486      +/-   ##
==========================================
- Coverage   91.18%   82.66%   -8.53%     
==========================================
  Files          74       74              
  Lines        4188     4188              
==========================================
- Hits         3819     3462     -357     
- Misses        369      726     +357     
Flag Coverage Δ
cli_func_v4 ?
py_func_v4 ?
unit 82.66% <88.88%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/client.py 84.78% <88.88%> (-1.98%) ⬇️
gitlab/v4/cli.py 40.37% <0.00%> (-41.14%) ⬇️
gitlab/v4/objects/files.py 52.94% <0.00%> (-39.71%) ⬇️
gitlab/v4/objects/milestones.py 71.42% <0.00%> (-28.58%) ⬇️
gitlab/v4/objects/labels.py 65.21% <0.00%> (-28.27%) ⬇️
gitlab/cli.py 60.34% <0.00%> (-25.87%) ⬇️
gitlab/v4/objects/tags.py 63.88% <0.00%> (-25.00%) ⬇️
gitlab/utils.py 65.51% <0.00%> (-24.14%) ⬇️
gitlab/v4/objects/repositories.py 57.62% <0.00%> (-23.73%) ⬇️
gitlab/v4/objects/settings.py 73.68% <0.00%> (-21.06%) ⬇️
... and 17 more
JohnVillalovos requested review from max-wittig and nejch May 31, 2021 01:07 max-wittig reviewed May 31, 2021
View reviewed changes
max-wittig reviewed May 31, 2021
View reviewed changes
max-wittig reviewed May 31, 2021
View reviewed changes
max-wittig reviewed May 31, 2021
View reviewed changes
max-wittig reviewed May 31, 2021
View reviewed changes
max-wittig reviewed May 31, 2021
View reviewed changes
max-wittig requested changes May 31, 2021
View reviewed changes

max-wittig left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

Thanks for your MR. Just some suggestions!

nejch reviewed May 31, 2021
View reviewed changes
JohnVillalovos requested review from max-wittig and nejch June 1, 2021 22:04 nejch reviewed Jun 9, 2021
View reviewed changes

nejch left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

Only some tiny notes from me. I think this should go into the 3.0.0 milestone, right?

nejch added this to the v3.0.0 milestone Jun 9, 2021

JohnVillalovos commented Jun 9, 2021



Copy link Copy Markdown
Member

Author

Only some tiny notes from me. I think this should go into the 3.0.0 milestone, right?

3.0.0 is fine for me. Earlier is also fine for me.

JohnVillalovos requested a review from nejch June 9, 2021 23:11 JohnVillalovos self-assigned this Jun 13, 2021 nejch mentioned this pull request Jun 14, 2021 Breaking changes in 3.0.0 #1520 Closed 15 tasks done

JohnVillalovos commented Sep 7, 2021



Copy link Copy Markdown
Member

Author

@nejch Is there anything else that needs to be done for this to get merged?

nejch commented Sep 8, 2021



Copy link Copy Markdown
Member

@nejch Is there anything else that needs to be done for this to get merged?

Actually no @JohnVillalovos this was ready but I had this idea of getting a bunch of things into 3.0.0 🤣 Let's just do it. Could you just rebase & amend the commit message to have a breaking change trailer for semantic-release?

JohnVillalovos commented Sep 8, 2021



Copy link Copy Markdown
Member

Author

amend the commit message to have a breaking change trailer for semantic-release?

How do I do that? I'm not sure what goes in the message to indicate a breaking change.

Thanks.

nejch commented Sep 8, 2021



Copy link Copy Markdown
Member

amend the commit message to have a breaking change trailer for semantic-release?

How do I do that? I'm not sure what goes in the message to indicate a breaking change.

Thanks.

Sure! Here are some examples https://www.conventionalcommits.org/en/v1.0.0/#examples

Actually, maybe it's easier to just amend the title as fix!: raise error if there is a 301/302 redirection, looks like it'll have the same effect :) Then the release action should bump it.

fix!: raise error if there is a 301/302 redirection d56a434
Before we raised an error if there was a 301, 302 redirect but only
from an http URL to an https URL.  But we didn't raise an error for
any other redirects.

This caused two problems:

  1. PUT requests that are redirected get changed to GET requests
     which don't perform the desired action but raise no error. This
     is because the GET response succeeds but since it wasn't a PUT it
     doesn't update. See issue:
     #1432
  2. POST requests that are redirected also got changed to GET
     requests. They also caused hard to debug tracebacks for the user.
     See issue:
     #1477

Correct this by always raising a RedirectError exception and improve
the exception message to let them know what was redirected.

Closes: #1485
Closes: #1432
Closes: #1477

JohnVillalovos commented Sep 8, 2021



Copy link Copy Markdown
Member

Author

Actually, maybe it's easier to just amend the title as fix!: raise error if there is a 301/302 redirection, looks like it'll have the same effect :) Then the release action should bump it.

Done!

Thanks.

nejch mentioned this pull request Sep 8, 2021 Use a single http mock library (responses) and drop httmock #1591 Closed

JohnVillalovos commented Sep 8, 2021



Copy link Copy Markdown
Member

Author

Thanks for your MR. Just some suggestions!

@max-wittig I believe I resolved all your comments. I marked them as resolved.

nejch approved these changes Sep 8, 2021
View reviewed changes

nejch commented Sep 8, 2021



Copy link Copy Markdown
Member

Thanks for your MR. Just some suggestions!

@max-wittig I believe I resolved all your comments. I marked them as resolved.

I've also opened an issue to resolve the rest (by using responses instead)

nejch merged commit 3742405 into python-gitlab : master Sep 8, 2021 JohnVillalovos deleted the jlvillal/prohibit_redirection branch January 4, 2022 06:51 Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

4 participants