Fix that receiving HTML email fails if it contains a link without an href attribute (#31695).

Patch by Marius BALTEANU.


git-svn-id: http://svn.redmine.org/redmine/trunk@18988 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2019-11-09 06:06:05 +00:00
parent 09af8e6683
commit fc2e4c1eba
4 changed files with 32 additions and 2 deletions

View File

@@ -37,7 +37,15 @@ module Redmine
'h6' => {:pre => "\n\n###### ", :post => "\n\n"},
'th' => {:pre => '*', :post => "*\n"},
'td' => {:pre => '', :post => "\n"},
'a' => lambda {|node| node.content.present? ? %| [#{node.content}](#{node.attributes['href'].value}) | : %| #{node.attributes['href'].value} |}
'a' => lambda do |node|
if node.content.present? && node.attributes.key?('href')
%| [#{node.content}](#{node.attributes['href'].value}) |
elsif node.attributes.key?('href')
%| #{node.attributes['href'].value} |
else
node.content
end
end
)
end
end

View File

@@ -37,7 +37,15 @@ module Redmine
'h6' => {:pre => "\n\nh6. ", :post => "\n\n"},
'th' => {:pre => '*', :post => "*\n"},
'td' => {:pre => '', :post => "\n"},
'a' => lambda {|node| node.content.present? ? %| "#{node.content}":#{node.attributes['href'].value} | : %| #{node.attributes['href'].value} |}
'a' => lambda do |node|
if node.content.present? && node.attributes.key?('href')
%| "#{node.content}":#{node.attributes['href'].value} |
elsif node.attributes.key?('href')
%| #{node.attributes['href'].value} |
else
node.content
end
end
)
end
end