mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: schemaless urls in emails
This commit is contained in:
parent
7c07079ed9
commit
561792a615
2 changed files with 8 additions and 5 deletions
|
@ -20,9 +20,15 @@ module Email
|
|||
img['style'] = "max-width: 694px;"
|
||||
end
|
||||
|
||||
# ensure all urls are absolute
|
||||
if img['src'] =~ /^\/[^\/]/
|
||||
img['src'] = "#{Discourse.base_url}#{img['src']}"
|
||||
end
|
||||
|
||||
# ensure no schemaless urls
|
||||
if img['src'].starts_with?("//")
|
||||
img['src'] = "http:" + img['src']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -42,9 +48,7 @@ module Email
|
|||
reset_tables
|
||||
end
|
||||
|
||||
|
||||
def format_html
|
||||
|
||||
style('h3', 'margin: 15px 0 20px 0; border-bottom: 1px solid #ddd;')
|
||||
style('hr', 'background-color: #ddd; height: 1px; border: 1px;')
|
||||
style('a',' text-decoration: none; font-weight: bold; color: #006699;')
|
||||
|
@ -58,7 +62,6 @@ module Email
|
|||
pre.replace(pre.text)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def to_html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue