After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 699997 - Show unreferenced images in multipart/related parser
Show unreferenced images in multipart/related parser
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
3.8.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks: 703515
 
 
Reported: 2013-05-09 10:50 UTC by David Woodhouse
Modified: 2013-09-30 12:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Offending email (196.06 KB, message/rfc822)
2013-09-18 11:06 UTC, David Woodhouse
  Details
evo patch (2.64 KB, patch)
2013-09-30 12:06 UTC, Milan Crha
committed Details | Review

Description David Woodhouse 2013-05-09 10:50:26 UTC
I have an email which, when viewed, will reliably trigger the following:

  • #0 g_logv
    at gmessages.c line 981
  • #1 g_log
    at gmessages.c line 1010
  • #2 g_return_if_fail_warning
    at gmessages.c line 1019
  • #3 handle_mail_request
    at e-mail-request.c line 91
  • #4 run_in_thread
    at gsimpleasyncresult.c line 871
  • #5 io_job_thread
    at gioscheduler.c line 89
  • #6 g_task_thread_pool_thread
  • #7 g_thread_pool_thread_proxy
    at gthreadpool.c line 309
  • #8 g_thread_proxy
    at gthread.c line 798
  • #9 start_thread
    at pthread_create.c line 308
  • #10 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 113

Comment 1 Milan Crha 2013-07-02 17:21:13 UTC
Is the email shareable?
Comment 2 David Woodhouse 2013-09-18 11:06:33 UTC
Created attachment 255162 [details]
Offending email

This sample message triggers the same warning.

And also fails to display the inline image. Thunderbird has a similar issue (this message is taken from https://bugzil.la/883932 )

Thunderbird does at least seem to show the image as an attachment, We don't show it at all.
Comment 3 Milan Crha 2013-09-19 09:05:07 UTC
Thanks. I can reproduce it with your message too.
Comment 4 Milan Crha 2013-09-19 09:40:19 UTC
The problem is how they reference the image. They use
   src="d0176599-66b6-4266-b625-1b33c4b206ee.png"
while the correct way of identifying attached images is through their Content-ID header (the image has that header, interestingly), thus something like this:
   src="cid:121dbd5e-15af-4ff5-9355-42e54bcba13f"

Evolution (or maybe webkit) turns the first reference into a full URI, which looks like:
   mail://<account-uid>/path/to/mail/d0176599-66b6-4266-b625-1b33c4b206ee.png
which is not part of the part list, thus the request for it returns NULL. Email message is referenced as
   mail://<account-uid>/path/to/mail/652245
where the last number in the path is message ID.

Using correct cid notation turns the request for the image to:
   mail://<account-uid>/path/to/mail/652245?part_id=cid%3A121dbd5e-
   15af-4ff5-9355-42e54bcba13f&mode=3
which works as expected, the image is shown. I also made a typo in the cid, then I've got this runtime warning instead:

>evolution-mail-CRITICAL **: handle_mail_request: assertion `part != NULL' failed

('part_list' changed to 'part' - it failed later).

From that I'd say, the two runtime warnings are misleading, they only claim when a broken message is parsed. Thus I would remove them, and add debug prints showing what was requested and whether anything was found instead. I do not want to support broken mail generator (also see [1]).

The other part, why the image was not shown as an attachment, is bug in evolution. I see it was properly recognized as attachment, but it was left hidden for some reason (probably because of the "inline" notation inside multipart/related part). I'll investigate this further.

[1] http://tools.ietf.org/html/rfc2392
Comment 5 Milan Crha 2013-09-25 07:38:12 UTC
I committed some debugging functions into evolution for 3.11.1+ (commit 6d96953) and 3.10.1+ (commit 59fbba3) which apart of debugging itself avoids the runtime warnings from this bug report. It doesn't show the hidden attachment from the multipart/related part.
Comment 6 Milan Crha 2013-09-30 12:06:18 UTC
Created attachment 256077 [details] [review]
evo patch

for evolution;

Let's try this way. The first thing is that the multipart/related parser didn't expect the 'display part' being multipart/alternative, thus I added there this check and a traverse for a text/html part (for the CID usage checking).

As the next change, in case the CID part is not referenced in the text/html part, and it's an image, wrap it as a real attachment.

One problem is that the parser doesn't know whether the picked text/html part will be displayed at all, though I believe it's a pretty good guess, because you either get those multipart/related images as attachments or shown in the HTML body, when it's rendered.
Comment 7 Milan Crha 2013-09-30 12:12:48 UTC
Created commit 6a65912 in evo master (3.11.1+)
Created commit b1005b6 in evo gnome-3-10 (3.10.1+)