Fix the Edit Single File behaviour
What does this MR do and why?
Related to: Code changes lost when commit message violates ... (#487761 - closed)
When editing a file directly ("Edit single file"), if a user attempts to commit changes with a message that doesn't comply with the configured push rules, the commit is correctly rejected. However, the code changes are lost, requiring the user to re-enter their modifications.
This happens because, when updating the file fails, the response incorrectly includes a 200 OK status code, causing the frontend to treat it as a success.
This MR resolves the issue by sending a 422 Unprocessable Entity status code when updating a file fails, along with an appropriate error message.status code.
Local test
Screen_Recording_2025-01-31_at_7.50.22_pm
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
You can follow these steps.