mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
DEV: Add spec for Email::Sender
for upload links in plain text emails.
This commit is contained in:
@ -72,7 +72,7 @@ module Email
|
||||
# These are the links we add when a user uploads a file or image.
|
||||
# Ideally we would parse general markdown into plain text, but that is almost an intractable problem.
|
||||
url_prefix = Discourse.base_url
|
||||
@message.parts[0].body = @message.parts[0].body.to_s.gsub(/<a class="attachment" href="(\/uploads\/default\/[^"]+)">([^<]*)<\/a>/, '[\2](' + url_prefix + '\1)')
|
||||
@message.parts[0].body = @message.parts[0].body.to_s.gsub(/<a class="attachment" href="(\/uploads\/default\/[^"]+)">([^<]*)<\/a>/, '[\2|attachment](' + url_prefix + '\1)')
|
||||
@message.parts[0].body = @message.parts[0].body.to_s.gsub(/<img src="(\/uploads\/default\/[^"]+)"([^>]*)>/, '')
|
||||
|
||||
@message.text_part.content_type = 'text/plain; charset=UTF-8'
|
||||
|
Reference in New Issue
Block a user