Ignore nil labels with issuable creation
If a user provides `nil` as a parameter for `labels`, creating an issue, merge request, or epic would fail with a 500 error. This happened because Rails would attempt to iterate on the association. This issue was exposed when we upgraded Grape in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27276 because `nil` values were not coerced to empty Arrays automatically. `IssuableBaseService#label_ids_to_filter` attempts to map the `labels` value to `label_ids` and clears out the `labels` key. However, this isn't done if the `labels` value is `nil`. To avoid this, we should always clear out the key after `label_ids_to_filter` completes. Closes https://gitlab.com/gitlab-org/gitlab/-/issues/215936
Showing
Please register or sign in to comment