When submitting a comment on unchanged lines it fails with "can't be blank" error (422)
Summary
Bug when adding a suggestion to a file in a merge request.
Steps to reproduce
- Open the diffs tab of the merge request gitlab-com/www-gitlab-com!60677 (diffs)
- Expand the lines to show line 567/566 (it will have a grey background)
- Select a line 567/566 to add a comment. (the error occurs for both inline and parallel modes)
- Add a comment and click
Add Comment Now - A red banner saying there's an error "Saving the comment failed" appears at the top of the page. Comment is gone.
Notes:
- The file chosen is huge: it's a Yaml file > 1MB, 26600+ lines.
- The comment was added to a line that hasn't been edited in the merge request.
Example Project
Happened on gitlab-com/www-gitlab-com!60677 (merged).
What is the current bug behavior?
- Cannot add a comment with a suggestion.
- Cannot add a comment without a suggestion.
What is the expected correct behavior?
- Able to add a comment with or without a suggestion.
Relevant logs and/or screenshots
- Clicked a non-edited line to comment.
- Added a suggestion.
- Clicked "Add comment now".
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
Edited by Jay McCure