Inline Image post via Thunderbird not processed properly

On the site I am test driving with a few willing participants (v2.1.0.beta3 +136), someone created a new topic via email using Thunderbird with three inline images. Something got messed up, as this is what came through where the images should have been:

<img moz-do-not-send="false" src="/uploads/default/original/1X/1c7fd6675d43e41fd6451802c7595ece0d9cea4d.jpg" alt="WE 2500 -
  transparent" height="300" width="400">

<img moz-do-not-send="false" src="/uploads/default/original/1X/e40f133566b4b9e17da781cd78f0a22657a19e87.jpg" alt="WE 2500
  transparent - back" height="300" width="400">

<img moz-do-not-send="false" src="/uploads/default/original/1X/97df6e399840418821cbfbdabcb6af0de5d7cfd0.jpg" alt="WE 2500
  transparent" height="300" width="400">

The image that the user sent inline is in fact stored on my server at the aforementioned src location, so Discourse is apparently able to extract the image from the email message. However, instead of putting the image into the post, it just replaces the src tag from the email with the location where the image is stored. See the same snippet from the original email message:

  <img moz-do-not-send="false"
    src="cid:part1.3D21F859.C11923DA@verizon.net" alt="WE 2500 -
    transparent" class="" height="300" width="400"><br>
  <br>
  <img moz-do-not-send="false"
    src="cid:part2.0838A5E5.943C8815@verizon.net" alt="WE 2500
    transparent - back" class="" height="300" width="400"><br>
  <br>
  <img moz-do-not-send="false"
    src="cid:part3.E9D6AC1E.7457D6BA@verizon.net" alt="WE 2500
    transparent" class="" height="300" width="400"><br>

I’m able to post inline images from Gmail, so this seems like a Discourse/Thunderbird interaction issue, and not an email inline image problem in general.

If anyone would like to see the full email message, I’d gladly send it over privately. The pictures came through fine when he forwarded it to my Gmail account.

Can you reply via email to this message with an example failure?

1 Like

I just asked the user to tell me what steps he took to produce the failed message. I will try to reproduce it and then I will post back.

2 Likes

I can’t see why this wouldn’t produce an image, <img> is valid markdown (at least on Discourse):

<img src='//assets-meta-cdck-prod-meta.s3.dualstack.us-west-1.amazonaws.com/original/3X/9/e/9e8c4ec0ee685ff6e7721b2da38a016c996c489c.png'>

Or do you mean the the tags literally came through like that? As in, the tags were rendered within a preformatted text block?

2 Likes

The post literally came through like that:

1 Like

A-ha, I’ve seen this a few times with Thunderbird (but never with images, just with text so it didn’t really impact the usability/readability of the email).

I imagine what’s going on here is that somewhere in the HTML → Markdown conversion some whitespace is being added (or not removed) producing something like this:

    <img blah blah blah blah>

which is rendered like so:

<img blah blah blah blah>

Getting the raw markdown output of the post will confirm this. Do that by replacing the /t/<slug>/ part of the url with /raw/, eg:

https://meta.discourse.org/t/inline-image-post-via-thunderbird-not-processed-properly/94961/5 → https://meta.discourse.org/raw/94961/5

3 Likes

Here’s what I see:

Photos of a 2500 set with transparent housing.

<img moz-do-not-send="false" src="/uploads/default/original/1X/1c7fd6675d43e41fd6451802c7595ece0d9cea4d.jpg" alt="WE 2500 -
  transparent" height="300" width="400">

<img moz-do-not-send="false" src="/uploads/default/original/1X/e40f133566b4b9e17da781cd78f0a22657a19e87.jpg" alt="WE 2500
  transparent - back" height="300" width="400">

<img moz-do-not-send="false" src="/uploads/default/original/1X/97df6e399840418821cbfbdabcb6af0de5d7cfd0.jpg" alt="WE 2500
  transparent" height="300" width="400">

And here’s a picture just in case that doesn’t format properly:

Yeah, as I thought, it’s whitespace causing it to be rendered as a preformatted block.

Easiest way to debug this is with the raw email, but it’ll contain private information, so I suggest you PM it to @zogstrip directly, rather than post it out in the open here.

You can extract the raw email by clicking the :email: icon next the topic date in the top right, and copying and pasting the contents of the raw tab into a text file. Then upload that text file in a PM to @zogstrip.

@zogstrip I hope that’s alright with you (it has been whenever I’ve PMed you my dodgily formatted emails!)

3 Likes

Oh cool, I didn’t realize you could extract the raw email that way.

PM sent. Thanks for looking into this, Leo.

4 Likes

Better late than never :wink:

This will be fixed once this PR is merged :ok_hand:

https://github.com/discourse/discourse/pull/9586

4 Likes