Upload rewriter uses a regex to find images to reupload, missing <img>s etc.

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

See #458847 (comment 1889353526):

Actually, I just noticed that this epic was promoted from an issue.

You can see that the images are working in the source issue: #337083 (comment 1248507014)

When you promote an epic, Gitlab::Gfm::UploadsRewriter re-uploads these to the new parent (the group). But it only handles those that match the pattern in https://gitlab.com/gitlab-org/gitlab/-/blob/eabf08000ecf9faae56f0891992067331a7d2fbe/app/uploaders/file_uploader.rb#L19-21.

This does not include those manually inserted using HTML tags.

The only correct way to find all the images to reupload is to render the Markdown, then find images in the DOM and match the srcs, rather than trying to regex the source as we currently do.

Edited by Asherah Connor