Last Comment Bug 351109 - Reply/Forward/Edit of .EML file corrupts image URL
: Reply/Forward/Edit of .EML file corrupts image URL
Product: MailNews Core
Classification: Components
Component: Composition (show other bugs)
: Trunk
: All All
-- normal with 1 vote (vote)
: Thunderbird 11.0
Assigned To: David :Bienvenu
: 531263 (view as bug list)
Depends on: 224733
  Show dependency treegraph
Reported: 2006-09-01 16:49 PDT by Mike Cowperthwaite
Modified: 2011-11-10 16:24 PST (History)
7 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

this fixes reply and forward/inline edit message as new for .eml files (12.81 KB, patch)
2011-10-10 17:24 PDT, David :Bienvenu
neil: review+
standard8: superreview+
Details | Diff | Splinter Review

Description User image Mike Cowperthwaite 2006-09-01 16:49:28 PDT
TB 3a1-0831, 2a1-0901,

Open a .EML file for a multipart/related message that's text/html with an embedded image.  Select Reply, Forward-Inline, or Edit-As-New to create a new HTML compose window: the image does not appear in the compose window.

The problem is invalid escaping of the URL into the file

Example: source of the original message:
<img src="" title=""
 alt="An example" width="225" height="200"><br>

Source of the reply in the compose window:
<img moz-do-not-send="true"
                 ~~~~~        ~~~~~
 title="" alt="An example" height="200" width="225"><br>

Also, I don't think that moz-do-not-send belongs there either.

Source of the Edit-As-New compose window:
                          ~~~~~        ~~~~~
 title="" alt="An example" height="200" width="225"><br>

Source of the forward-inline compose window:
<img moz-do-not-send="true"
                          ~~~~~        ~~~~~
 title="" alt="An example" height="200" width="225"><br>

This is very similar to bug 307023, but with a different source.
Also bug 224733.
Comment 1 User image Joe Sabash [:JoeS1] 2008-08-23 19:01:14 PDT
If we offer a means to save compositions in the the eml format...
(don't know why we do that except for compatibility with OE)
...For those that compose and send in html, the eml implementation is a complete disaster.

Comment 2 User image Ludovic Hirlimann [:Usul] 2009-11-27 03:27:56 PST
*** Bug 531263 has been marked as a duplicate of this bug. ***
Comment 3 User image Kevin 2009-11-27 03:46:07 PST
Since our company installs Thunderbird for +1500 clients and this bug is being reported to us many times and we are held responsible for the software we install. I would like to ask to consider the importance of the bug. 

Why: We created an addon for Thunderbird allowing our clients to save e-mails from Thunderbird to our office management program (save e-mails project related on a server). From our software they open the saved EML's to read/reply/forward them using Thunderbird. This is appearently unusable for the moment because the
images (even in signatures) are invisible. This is an attempt of our company to let professionals use Thunderbird in a specific sector (Architects) in Belgium, The Netherlands, Luxembourg, France and Germany. We hope this bug will be fixed soon. This is the only bug that's making it difficult to use Thunderbird for our customers. We would like to keep promoting Thunderbird instead of switching to an alternative. If I can help in any way fixing this error, I am at your disposal.
Comment 4 User image :aceman 2011-09-27 13:45:03 PDT
Bug 307023 seems to be fixed. Is this bug 351109 still an issue in Thunderbird 7? If yes, can you attach a sample eml file what has the problem?
Comment 5 User image David :Bienvenu 2011-10-03 17:00:38 PDT
sadly, I don't think this is fixed by the fix for bug 307023. But I will look at it.
Comment 6 User image David :Bienvenu 2011-10-07 17:17:45 PDT
I don't think this is an escaping issue; I believe it has to do with the fact that we're not converting the file: url to a mailbox url in the quoting case.
Comment 7 User image David :Bienvenu 2011-10-10 17:24:09 PDT
Created attachment 566090 [details] [diff] [review]
this fixes reply and forward/inline edit message as new for .eml files

this fixes .eml handling of reply/forward inline of messages with inline images, modulo bug 692875.
Comment 8 User image David :Bienvenu 2011-10-21 07:49:42 PDT
Comment on attachment 566090 [details] [diff] [review]
this fixes reply and forward/inline edit message as new for .eml files

This goes along with the fix in bug 692875, in that you need that fix applied to see that saving a message as a draft after replying to a .eml file works.
Comment 9 User image 2011-10-23 10:07:04 PDT
Comment on attachment 566090 [details] [diff] [review]
this fixes reply and forward/inline edit message as new for .eml files

>+    nsCString origMsgUri(originalMsgURI);
>+    origMsgUri.Replace(0, 5, NS_LITERAL_CSTRING("mailbox:"));
>+    origMsgUri.Append(NS_LITERAL_CSTRING("?number=0"));
>+    mOriginalMsgURI = origMsgUri;
This is really confusing. It turns out that this method is only ever called from BuildQuotedMessageAndSignature, and curiously it always passes mOriginalMsgURI.get() and mWhatHolder, and the latter is always 1!

I would just ignore originalMsgURI (and possibly also "what") at this point, modify mOriginalMsgURI in-place, and remove BuildQuotedMessageAndSignature in a followup bug. r=me with that fixed.

Nit: mOriginalMsgURI.AppendLiteral("?number=0"); (happens several times)
Comment 10 User image David :Bienvenu 2011-11-10 16:24:27 PST
fix checked in, with Neil's comments addressed -

Note You need to log in before you can comment on or make changes to this bug.