FIX: malformed <details> should not break email

This commit is contained in:
Sam 2016-05-02 12:33:56 +10:00
parent 3f9ed76dad
commit 672d6924ec
1 changed files with 8 additions and 3 deletions

View File

@ -19,10 +19,15 @@ after_initialize do
# replace all details with their summary in emails # replace all details with their summary in emails
fragment.css("details").each do |details| fragment.css("details").each do |details|
summary = details.css("summary")[0] summary = details.css("summary")
if summary && summary[0]
summary = summary[0]
if summary && summary.respond_to?(:name)
summary.name = "p" summary.name = "p"
details.replace(summary) details.replace(summary)
end end
end end
end
end
end end