Skip to content

Commit

Permalink
strip out gmail signature
Browse files Browse the repository at this point in the history
  • Loading branch information
parterburn committed Jan 8, 2024
1 parent 34fda26 commit ce5ad11
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/lib/email_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ def clean_html_version(html)
html = Rinku.auto_link(html, :all, 'target="_blank"')
html = ActionController::Base.helpers.sanitize(html, tags: %w(strong em a div span ul ol li b i br p hr u em blockquote), attributes: %w(href target))
html = html.split("<br>--<br>").first # strip out gmail signature
html = html.split("<div><br></div><div>--</div>").first # strip out gmail signature
html = html.split("<br>--").first # strip out gmail signature
html&.gsub!(/<div style="display:none;border:0px;width:0px;height:0px;overflow:hidden;">.+<\/div>/, "") # remove hidden divs / tracking pixels
html&.gsub!(/src=\"cid\:\S+\"/, "src=\"\" style=\"display: none;\"") # remove attached images showing as broken inline images

Expand Down

0 comments on commit ce5ad11

Please sign in to comment.