Skip to content

Add email image filter

First MR to add the prerequisite for fixing gitlab-org/gitlab-ce#1161

This MR adds a filter that replaces linked imaged with inline images.
This is needed, because we introduced access control in 7.8 which broke the image display in emails send by gitlab.

I'm still getting 3 rubocop warnings which i'm not sure how to deal with.
I kinda want to ignore the 2nd one, but i'm not sure about the others.

Offenses:

lib/html/pipeline/gitlab/gitlab_email_image_filter.rb:11:9: C: Assignment Branch Condition size for call is too high. [20.32/15]
        def call
        ^^^
lib/html/pipeline/gitlab/gitlab_email_image_filter.rb:11:9: C: Method has too many lines. [14/10]
        def call
        ^^^
lib/html/pipeline/gitlab/gitlab_email_image_filter.rb:12:29: C: Use next to skip iteration.
          doc.search('img').each do |img|
                            ^^^^

@razer6 @DouweM can you review and merge if ok please?

After this has been merged and published, we can merge the actual fix in gitlab-ce (coming today)

Merge request reports