[Fix #1078] Fix a crasher in HtmlToStringHelper

This commit is contained in:
gregoirenovel 2017-12-12 10:06:50 +01:00
parent 2a14993374
commit 04d17a2ed0
2 changed files with 14 additions and 5 deletions

View file

@ -1,10 +1,14 @@
module HtmlToStringHelper
def html_to_string(html)
string_with_tags = html
.gsub(/<br[ ]?[\/]?>/, "\n")
.gsub('</p>', "\n")
.gsub('<p>', '')
if html.blank?
html
else
string_with_tags = html
.gsub(/<br[ ]?[\/]?>/, "\n")
.gsub('</p>', "\n")
.gsub('<p>', '')
strip_tags(string_with_tags)
strip_tags(string_with_tags)
end
end
end