-
Notifications
You must be signed in to change notification settings - Fork 954
Fix uptade protected branch #1680
Fix uptade protected branch #1680
Conversation
a29ec6a
to
121d1ce
Compare
Did you try to get it working without using the body (so with using query params instead)? Can you post the result/error when you tried that? |
FYI I'm asking because if you add So to avoid potential issues with other calls I prefer to not change this. Unless you can show that you tested all other impacted calls and they do not break... |
This fix works for me as well. @bmsareias thank you As for using query params - it doesn't work. It will generate |
Hey @svanharmelen, Based on my (very narrowed tests) all the calls with any Update/Delete do fail with error "400 {error: allowed_to_[push, merge, unprotect] is invalid}" even thou they are correctly formatted as per API specs, furthermore a simple change from PATH to Body Requests fixes the issue all together with the exact same calls. What I believe it's going on is: most of the calls to this endpoint work with PATH requests, however and since the 3 properties in question are array lists, I believe Gitlab doesn't allow them to be called via PATH, as it would be very easy for such a request to exhaust the PATH size limits for a very small amount of data pushed to the endpoint. Yes, I do agree this is potentially dangerous to the overall stability of the entire LIB as this change provokes a design change to a large amount of endpoint calls, and given this i'm only seeing a very narrow group of solutions:
Final note, i've created this PR to raise awareness of the fix/issue/solution that resulted from my own tests and needs, and with that i'm all open to suggestions and discuss better approaches to the fix/solution that better aligns to the community overall. With that said, if you see it more fit to mark this as WIP, just let me know :) |
@MUlt1mate glad to hear! Yes from my tests all calls that want to UPDATE/DELETE (and to some extent CREATE) new entries on any of those 3 array/list/slices results in 400 - Invalid <Attribute_Name>. |
Thanks for the responses! Funny enough I don't have access to a GitLab instance myself, but looking through the code I see 3 other API's (implemented by this package) that currently use
If you can verify that these 3 calls also work when using the request body, then I am good to merge this PR... |
The first method has no parameters, so it should be fine. I don't have administrator permissions to check it. |
The Users API only applies to Self-Managed Instances (which I don't have one accessible at this point) Can try to test the Users API if I manage to have the time over the weekend, and will ask around for a project that has the Error Tracking feature that I (or proxied through someone else) has maintainer access on it. |
OK... Well I guess in this case I'm good with moving this one forward and fixing things forward when it turns out one of those 3 APIs does end up having issues. Potentially not the most user friendly approach, but we are actually fixing a bug here so I guess in this case it can be justified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take it... Thanks @bmsareias and @MUlt1mate 👍🏻
Adds missing elements for the full API functionality of UpdateProtectedBranch() method.
As consequence of this, it's mandatory by API to ship this data via body to the API, therefore I've added the case to the already existing switch-case.
This should have more extensive tests via the testing suit. I've only tested this for my own needs.
This PR fixes #1657