Full URL for image in text/plain emails


(Isaiah Norton) #1

In the the text/plain version of emails from Discourse, <img> URLs are relative. For example, the email notification for this post has the full URL in text/html, but only the relative URL in text/plain.

example email contents
----==_mimepart_58f541ae7b23d_15dd3fe30efca3ec4330ef
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit


Hi everybody,

I am programming an extension module for Slicer 3D. In one step I need to call an external command (Elastix). At this point is when I obtain the following error:

<img src="/uploads/slicer/original/1X/6e7cf603bea688a3821efdb228bd5f65599bcb13.jpg" width="690" height="25">

I have not been able to solve it yet. Do you know how get rid of this problem? It works when I execute the call in a terminal.

I look forward to hearing from you. Thanks in advance.

Sincerely,
 

Alba.






---
[Visit Topic](http://discourse.slicer.org/t/external-calling-at-slicer-3d/136/1) or reply to this email to respond.
You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](http://discourse.slicer.org/email/unsubscribe/a6d3f9070a2ff5be8ac754586568b0e2829ade0f9669f001b039e8e4498bbe56).

----==_mimepart_58f541ae7b23d_15dd3fe30efca3ec4330ef
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 7bit

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><p></p><div style="margin-left: 15px">
<br>Hi everybody,

<p>I am programming an extension module for Slicer 3D. In one step I need to call an external command (Elastix). At this point is when I obtain the following error:</p>

<p><img src="http://discourse.slicer.org/uploads/slicer/original/1X/6e7cf603bea688a3821efdb228bd5f65599bcb13.jpg" width="auto" height="auto" style="max-width: 100%;"></p>

<p>I have not been able to solve it yet. Do you know how get rid of this problem? It works when I execute the call in a terminal.</p>

<p>I look forward to hearing from you. Thanks in advance.</p>

<p>Sincerely,</p>

<p>Alba.</p>

<p></p>
</div>

<hr>

<p><a href="http://discourse.slicer.org/t/external-calling-at-slicer-3d/136/1">Visit Topic</a> or reply to this email to respond.<br>You are receiving this because you enabled mailing list mode.</p>

<p>To unsubscribe from these emails, <a href="http://discourse.slicer.org/email/unsubscribe/a6d3f9070a2ff5be8ac754586568b0e2829ade0f9669f001b039e8e4498bbe56">click here</a>.</p>
----==_mimepart_58f541ae7b23d_15dd3fe30efca3ec4330ef--

I see there have been several related discussions and PRs in the past:

Some links in emails not including the full URL

Links in mail lack http(s) protocol

Fix relative URLs in plain text emails by peternlewis · Pull Request #2448 · discourse/discourse · GitHub

But I don’t see any current/open topics regarding this issue. Is there a configuration option I missed, or any work-around available? (after a few rounds of tweaks, this is the last major complaint about email mode from our die-hard mailing list user).


(Isaiah Norton) #2

Looking through the code and PR2448 more closely, the resolution to that PR, db5f2ae, only addressed the html output of the renderer. So I guess this substitution would also need to be applied to text_part?

Unless I hear otherwise, I’ll make a PR to that effect once I get an environment set up to verify the change.

(I suppose any change will take some time to be deployed on Standard, even if accepted… So I’ll ask the user to apply that regex locally for now if they want to use a text-only viewer)


(Eli the Bearded) #3

I haven’t delved into the code, but as a user I’ve noticed various lack-of-full URL issues.

In my most recent Meta Digest mailing, I see full URLs in markdown format in the plain text part of the mail:

[:success:](https://meta-s3-cdn.freetls.fastly.net/original/3X/b/1/b1be...) 
[image](https://meta-s3-cdn.freetls.fastly.net/optimized/3X/5/a/5af8...)

But I have seen ones like your example above (<img src="//discourse-meta.s3...) in the past. It may have to do with how the message was originally encoded, eg originally just a bare URL on a line versus in markdown.

The “Download My Posts” output uses the protocol less version here at Meta, but I’ve also seen lacking protocol and hostname (<img src="/uploads/default/original/...).