Ensure links in notifications footer are not escaped

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2018-08-03 11:50:47 +02:00
parent 9db5245153
commit c0c9e5dd6f
No known key found for this signature in database
GPG Key ID: 98DFFD1C0C62B70B
3 changed files with 10 additions and 1 deletions

View File

@ -14,7 +14,7 @@
%br
- if @target_url
- if @reply_by_email
= _('Reply to this email directly or %{view_it_on_gitlab}.') % { view_it_on_gitlab: link_to(_("view it on GitLab"), @target_url) }
= _('Reply to this email directly or %{view_it_on_gitlab}.').html_safe % { view_it_on_gitlab: link_to(_("view it on GitLab"), @target_url) }
- else
#{link_to _("View it on GitLab"), @target_url}.
%br

View File

@ -0,0 +1,5 @@
---
title: Ensure links in notifications footer are not escaped
merge_request: 21000
author:
type: fixed

View File

@ -87,6 +87,10 @@ shared_examples 'an email starting a new thread with reply-by-email enabled' do
include_examples 'an email with X-GitLab headers containing project details'
include_examples 'a new thread email with reply-by-email enabled'
it 'includes "Reply to this email directly or <View it on GitLab>"' do
expect(subject.default_part.body).to include(%(Reply to this email directly or <a href="#{Gitlab::UrlBuilder.build(model)}">view it on GitLab</a>.))
end
context 'when reply-by-email is enabled with incoming address with %{key}' do
it 'has a Reply-To header' do
is_expected.to have_header 'Reply-To', /<reply+(.*)@#{Gitlab.config.gitlab.host}>\Z/