Skip to content

Commit

Permalink
Sanitize review html
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjwc committed Sep 24, 2009
1 parent 72d2c1c commit 37b3572
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def relative_time(date, abbr=true, with_time=true, with_parens=true)
"#{datestamp}#{' '+timestamp if with_time} #{ago}"
end

def unescape_entities(html)
def unescape_entities(html, leave_dirty = false)
return nil if html.nil?
unescaped_html = html
unescaped_html.gsub!(/&/, "&")
Expand All @@ -125,7 +125,12 @@ def unescape_entities(html)
# Replace CDATA junk
unescaped_html.gsub!(/\<\!\[CDATA\[/, '')
unescaped_html.gsub!(/\]\]\>/, '')
return unescaped_html

if leave_dirty
unescaped_html
else
sanitize unescaped_html
end
end

def sanitize_summary(html)
Expand Down

0 comments on commit 37b3572

Please sign in to comment.