Fixed issue #1230, missing backslashes in body of sent emails.

This commit is contained in:
Jens Pfeifer 2017-07-13 09:59:22 +00:00
parent 9f6a4a99f5
commit c2234d7456
2 changed files with 9 additions and 1 deletions

View file

@ -156,7 +156,9 @@ Check if string is a complete html document. If not, add head and css styles.
return html if html =~ /<html>/i
Rails.configuration.html_email_body.sub('###html###', html)
# use block form because variable html could contain backslashes and e. g. '\1' that
# must not be handled as back-references for regular expressions
Rails.configuration.html_email_body.sub('###html###') {html}
end
=begin

View file

@ -22,6 +22,12 @@ class EmailBuildTest < ActiveSupport::TestCase
assert(result !~ /font-family/, 'test 2')
assert(result =~ %r{<b>test</b>}, 'test 2')
# Issue #1230, missing backslashes
# 'Test URL: \\storage\project\100242-Inc'
html = '<b>Test URL</b>: \\\\storage\\project\\100242-Inc'
result = Channel::EmailBuild.html_complete_check(html)
assert(result.include?(html), 'backslashes must be kept')
end
test 'html email + attachment check' do