Skip to content

Ignore nil labels with issuable creation

Stan Hu requested to merge sh-handle-nil-labels-issuables into master

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 !27276 (merged) 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 #215936 (closed)

Edited by Stan Hu

Merge request reports