Skip to content

Fix a bug with promoting Issues with attachments to Epics

What does this MR do?

This MR fixes a bug when promoting an Issue with attachments to an Epic.

The bug was introduced in !38646 (merged) where the new MarkdownContentRewriterService was passed the target's #project (in two places: here and here), where previously new_parent was passed instead. new_parent was either the #project or the #group.

When an Issue is promoted to an Epic, the target was the Epic, and as Epic#project is nil, this meant that a nil was passed to MarkdownContentRewriterService as the target_parent, which would result in an error when that class called Gitlab::Gfm::UploadsRewriter and methods on nil were called (see #236190 (closed)).

This MR passed the object's #resource_parent to MarkdownContentRewriterService which will correctly be a Project or Group.

QA Steps

  1. Create a group, and a project within the group, and an issue within that project.
  2. Attach an image to the issue, either in the issue's description, or in a comment on the issue.
  3. Save a comment on the issue with the quick action: /promote

On master this will cause an error, on this branch it will promote the Issue to an Epic.

Does this MR meet the acceptance criteria?


Availability and Testing

Edited by Dylan Griffith

Merge request reports