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,9 +19,14 @@ after_initialize do
# replace all details with their summary in emails
fragment.css("details").each do |details|
summary = details.css("summary")[0]
summary.name = "p"
details.replace(summary)
summary = details.css("summary")
if summary && summary[0]
summary = summary[0]
if summary && summary.respond_to?(:name)
summary.name = "p"
details.replace(summary)
end
end
end
end