discourse/discourse — pull request #2448 by peternlewis (2014-06-16 03:56:30+00:00)
Title: Fix relative URLs in plain text emails

When a user posts a message containing an image or file, JavaScript includes the file using a relative URL inside either an or HTML tag.

It could use a Markdown tag, but it doesn't. In any event, the HTML is jarring in the plain text email and the relative URL (just a path really) is useless.

Ideally, we would parse the markdown to plain text, but since markdown can contain any HTML, that would require redering as HTML and then extracting the text which is a lot of work for something few people will see.

Instead, this simple patch just converts the links that the Upload JavaScript inserted into full URL relatively readable markdown links.