Task List fails to update in MR

Summary

We've found a case where a Task List inside a merge request cannot be updated through the UI. When checking/unchecking an item in the list, we receive the error:

Someone edited this merge request at the same time you did. Please refresh the page to see changes.

When manually editing the markdown via Edit this issue does not occur. This also does not seem to be an issue in Issues.

@engwan and I have narrowed the issue down to these lines in IssuableBaseService, where tasklist_toggler.execute is returning a falsey value.

Steps to reproduce

Create a MR with the following text:


Try to check/uncheck any of the checkboxes.

You will see the error message.

## Related issues

https://gitlab.com/gitlab-org/security/gitlab/issues/68

## Developer checklist

- [x] Link this MR in the `links` section of the related issue on [GitLab Security].
- [x] Merge request targets `master`, or `X-Y-stable` for backports.
- [x] Milestone is set for the version this merge request applies to. A closed milestone can be assigned via [quick actions].
- [x] Title of this merge request is the same as for all backports.
- [x] A [CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html) is added without a `merge_request` value, with `type` set to `security`
- [x] Assign to a reviewer and maintainer, per our [Code Review process].
- [x] For the MR targeting `master`:
  - [x] Ping appsec team member who created the issue and ask for a non-blocking review with `Please review this MR`.
  - [x] Ensure it's approved according to our [Approval Guidelines].
- [ ] Merge request _must not_ close the corresponding security issue, _unless_ it targets `master`.

**Note:** Reviewer/maintainer should not be a Release Manager

## Maintainer checklist
- [ ] Correct milestone is applied and the title is matching across all backports
- [ ] Assigned to `@gitlab-release-tools-bot` with passing CI pipelines

[GitLab Security]: https://gitlab.com/gitlab-org/security/gitlab
[approval guidelines]: https://docs.gitlab.com/ee/development/code_review.html#approval-guidelines
[Code Review process]: https://docs.gitlab.com/ee/development/code_review.html
[quick actions]: https://docs.gitlab.com/ee/user/project/quick_actions.html#quick-actions-for-issues-merge-requests-and-epics

What is the current bug behavior?

Task list items can not be checked/unchecked.

What is the expected correct behavior?

Task list items should be able to be checked/unchecked.

Possible fixes

@digitalmoksha says:

It has to do with a blank line at the beginning of the text. This fails:


- [x] test

but this works:

- [x] test
Edited by Gabriel Mazetto