Fix 500 error when Commit action is missing
What does this MR do and why?
Sentry error: https://sentry.gitlab.net/gitlab/gitlabcom/issues/3402967
Problem
It's possible to provide an empty value for Commit action. It leads to 500 error.
Solution
Use allow_blank: false
validation.
How to verify
-
Replace
<PERSONAL_TOKEN>
with your token and execute in consolecurl --header "PRIVATE-TOKEN: <PERSONAL_TOKEN>" --header "Content-Type: application/json" http://127.0.0.1:3000/api/v4/projects/1/repository/commits -X POST -d '{"branch": "master", "commit_message": "Test", "actions": [{ "action": null, "file_path": "test" }]}'
-
You should see 400 error instead of 500 error.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vasilii Iakliushin