FIX: digest email has broken images in popular topics section

This commit is contained in:
Neil Lalonde 2016-11-21 12:33:40 -05:00
parent 47be1a8be9
commit 7d37c2b919
2 changed files with 7 additions and 1 deletions

View File

@ -97,4 +97,10 @@ module UserNotificationsHelper
UrlHelper.absolute("#{Discourse.base_uri}/images/emails/#{basename}")
end
def url_for_email(href)
URI(href).host.present? ? href : UrlHelper.absolute("#{Discourse.base_uri}#{href}")
rescue URI::InvalidURIError, URI::InvalidComponentError
href
end
end

View File

@ -129,7 +129,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<% if t.image_url.present? %>
<td style="color:#0a0a0a;line-height:1.3;margin:0;padding:0 16px 8px 8px;text-align:right;width:20%" align="right">
<img src="<%= Discourse.base_url_no_prefix + t.image_url -%>" height="64" style="-ms-interpolation-mode:bicubic;margin:auto;max-height:64px;max-width:100%;outline:0;text-align:right;text-decoration:none;">
<img src="<%= url_for_email(t.image_url) -%>" height="64" style="-ms-interpolation-mode:bicubic;margin:auto;max-height:64px;max-width:100%;outline:0;text-align:right;text-decoration:none;">
</td>
<% end %>