Closed Bug 501253 Opened 15 years ago Closed 15 years ago

Thunderbird can't find the pdf file attachment in this mail

Categories

(MailNews Core :: MIME, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nelson, Unassigned)

References

Details

(Whiteboard: [fixed by bug 468595])

Attachments

(2 files)

Seen with a TB3 nightly.

I have an email in my IMAP inbox folder that has a pdf file attachment. 
When I try to open that attachment from the message view pane, I get a 
window with a copy of the message, not the pdf attachment.  When I try to 
save the attachment as a file, again, I get a copy of the mail message 
body in the file, not a copy of the PDF file.  When I view the message 
source, and then copy and paste the base64-encoded attachment to another
window, and then base64 decode it, I get the expected PDF file.  

Maybe there's something wrong with the MIME encoding of this message.
Or maybe TBird is confused by the UTF8 encoding of the file name. (?)

A copy of the message is attached.
Filename is specified as next. (First word is not atom==encoded-word)
> Content-disposition: attachment;
>	filename="UTF-8?B?SXplbnBlIC0gTm90YSBUw6ljbmljYSA0MCAtIFZ1bG5l?=
>	=?UTF-8?B?cmFiaWxpZGFkIGVuIE9wZW5TU0wgeSBEZWJpYW4ucGQ=?=	=?UTF-8?B?Zg==?="
So filename used by Tb on MS Win becomes next. (? is replaced by -)
> UTF-8-B-SXplbnBlIC0gTm90YSBUw6ljbmljYSA0MCAtIFZ1bG5l-= rabilidad en OpenSSL y Debian.pdf
I think filename is irrelevant.

> When I try to open that attachment from the message view pane,
> I get a  window with a copy of the message, not the pdf attachment.
>  When I try to save the attachment as a file, again, I get a copy of the mail message body in the file, not a copy of the PDF file.

With which build?

"try to open that attachment" is "double click of icon for the pdf attachment in attachment pane of main mail window"?
What does "a window with a copy of the message" mean? Same as next?

I could see next phenomenon with Tb trunk 2009/6/28 build on MS Win-XP SP3, with the test mail in both local mail folder and IMAP folder.
  (0) View/Message Body As : Original HTML
      Display Attachments Inline : Checked
  (1) Stand-alone window.
      At thread pane, double-click the mail
      => mail source is displayed in message view box.
         attachments are displayed in attachment pane as expected.
      At thread pane, double-click the mail again
      => standalone window is reused, and mail is displayed as expected
  (2) Tab or Stand-alone window.
      At thread pane, "Open Message in New Tab" or double-click the mail
      => mail source is dusplayed in message view box.
         attachments are displayed in attachment pane as expected.
      At Tab or Standalone window, Click View/Character Encoding/UTF-8
      => mail is displayed as expected

In any case, at any step/any place, open/save of the pdf attachment had no problem in my test.
Was the mail sent to you as message/rfc822 part(forwarded or attached) originally?
Additional question.
Partially downloaded mail in offline-store? Can you know partial or not by checking offline-store content? (if big offlin-store file, tool such as unix-mbox to eml converter is required)
Comment #1 is test result with IMAP folder of offline-use=off (and local mail folder). I copied the mail to IMAP folder of offline-use=on, and I did "Open Message in New Window" quickly just after folder click, and I got corrupted offline-store data. No mail body was displayed in this case, because mail header/mail body data is lost(overlaid by partial attachment data).
"PDF open error" and "corrupted PDF data by Save" could be observed.
Note:
Needless to say, "Mail source display when Stand-alone window or Tab"(phenomenon of Comment #1) can be observed with both Case-1 & Case-2.

(Case-1) Normal case
  1. Offline-store file size=10KB(1 mail only), 
     Copy the mail to IMAP folder of offline-use=on
  2. Click folder, click the mail, wait for completion of download and
     normal mail display at message pane of three pane window.
     => offline-store file size=186KB
        (whole data including PDF is downloaded and written normally)
     => PDF open, save has no problem
(Case-2) Interfare of download with "Open Message in New Window"(double-click),
         but not so quickly after start of download compared to Comment #3
  1. Offline-store file size=10KB(1 mail only), 
     Copy the mail to IMAP folder of offline-use=on
  2. Click folder, click the mail, and double-click the mail at thread pane
     while mail downloading is in progress.
     => offline-store file size=70KB
        (whole data other than PDF part is downloaded and is written normally)
     => PDF open fails, "Save As" generates corrupted data.
        (problem of Comment #0 could be observed)

Following is data for the pdf in offline-store file. (All other data is normal)
> --Boundary_(ID_SjJJqft3zJ3V7JlRrinaFA)
> X-Mozilla-IMAP-Part: 2
> Content-type: application/pdf;
>  name="UTF-8?B?SXplbnBlIC0gTm90YSBUw6ljbmljYSA0MCAtIFZ1bG5l?=
>  =?UTF-8?B?cmFiaWxpZGFkIGVuIE9wZW5TU0wgeSBEZWJpYW4ucGQ=?=	=?UTF-8?B?Zg==?="
> Content-transfer-encoding: base64
> Content-disposition: attachment;
>  filename="UTF-8?B?SXplbnBlIC0gTm90YSBUw6ljbmljYSA0MCAtIFZ1bG5l?=
>  =?UTF-8?B?cmFiaWxpZGFkIGVuIE9wZW5TU0wgeSBEZWJpYW4ucGQ=?=	=?UTF-8?B?Zg==?="
> Content-description: =?UTF-8?B?SXplbnBlIC0gTm90YSBUw6ljbmljYSA0MCAtIFZ1bG5l?=
 =?UTF-8?B?cmFiaWxpZGFkIGVuIE9wZW5TU0wgeSBEZWJpYW4ucGQ=?=	=?UTF-8?B?Zg==?=
> 
> This body part will be downloaded on demand.
> --Boundary_(ID_SjJJqft3zJ3V7JlRrinaFA)

Nelson, do you use "display mail in new tab"?
I couldn't reproduce both of (a) "mail source in Stand-Alone Window or Tab" and (b) "corrupted/partial offline-store file data" with 2009/06/29 build(problem of Bug 498473 doesn't occur  any more). 
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1pre) Gecko/20090629 Shredder/3.0b3pre

(1) After fix of Bug 498473, mail body was normally displayed at any of Stand-Alone Window, Tab, and Message Pane of three pane main window.
(2) Offline-store file size increase was independent from display at Stand-Alone Window or Tab. Offline-store file size didn't increase by open of Stand-Alone Window. Offline-store file size increased upon normal display at message pane of three pane main window.

=> This bug is WORKSFORME for me.
OK, I have tested this now on both Windows and MacOSX with similar results.
On MAC 10.5.7, with TB 3.0b2 (20090223 - not very recent) if I right click 
the attachment in the attachment pane, and select Open, and open it with 
Mac's "Preview" pdf reader, it tells me the file is corrupt.  If I open it
with Mac's TextEdit, I see a short file, 236 bytess long, beginning with 48
bytes of binary, followed by this html:

<div class="moz-text-plain" wrap=true graphical-quote=true style="font-family: -moz-fixed"><pre wrap><BR><HR WIDTH="90%" SIZE=4><BR>This body part will be downloaded on demand.</pre></div>

If I right click, and select save as, it puts up a dialog to choose the file
name and directory, which has the UTF8 name in it and ends with .pdf.  If I 
save it, and then examine the file, it is the same file as described above.
The point is that TB thinks it is saving an attachment, and it save a file 
with the expected attachment name, but the wrong contents.  

The behavior I saw on Windows was similar but not identical.  It also saved 
a file with the expected file name but the wrong content.  Its content was 
also html content, but its content was the html content of the body of the 
message, not an attachment and not this odd 236 byte message about download on demand (which doesn't seem to be part of the original message).  

This is completely reproducible for me on two systems.  Like you, I used
 View/Message Body As : Original HTML
 Display Attachments Inline : Checked
The pdf does not display in-line.  Atempting to save the file appears to work,
but the content of the save file is the wrong content.

Again, the original mail message has the correct content, the full pdf file.

No, I don't use "open message in new tab".
The email message I attached was exactly as I received it.  It was not an 
attachment to another email first.  

I will be happy to test with a newer build of TB3 for Mac if you can tell me
how to replace the existing version with a newer one.  When I select 
"Check for Updates" from the Help menu, It always says "No updates found".   
I know how to do this on Wintel PC, but doing this on a MAC escapes me.
(In reply to comment #6)
> I know how to do this on Wintel PC, but doing this on a MAC escapes me.

> Get mac.dmg build from one of next sites.
> http://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-comm-1.9.1/
> http://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-comm-central-trunk/
> http://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/2009/07/
> See http://en.wikipedia.org/wiki/Apple_Disk_Image for .dmg file 
> For MS Win, get win32.zip build and UNZIP it.

> <div class="moz-text-plain" wrap=true graphical-quote=true style="font-family:
> -moz-fixed"><pre wrap><BR><HR WIDTH="90%" SIZE=4><BR>This body part will be
> downloaded on demand.</pre></div>

Once "partial (or "corrupted" but unable to detect) offline-store file data" is created, there is no ordinal way to recover from it. See Bug 468595 Comment #10 (put in "Depends on:".)
No longer blocks: 468595
Depends on: 468595
Wada,
I downloaded a .dmg file to originally install TB.  Once I've downloaded a 
newer .dbg file, do I just run the installer again?  Or must I first remove
the old Thunderbird.app file? or ??

Are you saying that the email message is corrupted?  
What is corrupt about it?
Perhaps this is a bug in the email program that sent the email?
One more thing.  The IMAP folder from which this message was taken is NOT
configured for off-line storage of messages.  The explanation given in 
Bug 468595 Comment #10 seems to assume that an offline folder is in use.
(In reply to comment #8)
> do I just run the installer again?
> Or must I first remove the old Thunderbird.app file?

Do safer way(uninstall/re-install, clean install) always in testing, please.

(In reply to comment #8)
> Are you saying that the email message is corrupted? What is corrupt about it?
> Perhaps this is a bug in the email program that sent the email?

I wanted to say:
  (A) Not original mail data problem. 
  (B) When completely corrupted mail data was generated during download by Tb
      in offline-store file, mail was not correctly displayed.
  (C) When partially downloaded mail data was generated(jpeg part data was not
      downloaded in offline-store), "Thunderbird can't find the pdf file
      attachment" was observed.
  (D) I couldn't see "Mail source display" in message pane of three pane window
      with any build.  
  (E) I could observe next with 6/28 build using your test mail, but I couldn't
      observe next after Bug 498473 was resolved(6/29 build or later).
      - Mail source display in stand-alone window or tab
  (F) Using your test mail and stand-alone window,
      I could generate next with 6/28 build, but I couldn't generate next 
      after Bug 498473 was resolved(6/29 build or later).  
      - completely-corrupted or partially-downloaded mail data in offline-store 

(In reply to comment #9)
> The IMAP folder from which this message was taken is NOT configured for off-line storage of messages.

If offline-use=no, downloaded mail is placed in "cache file"(I don't know which file). If data in the "cache file" somehow becomes partial data, I think same as above (C) occurs. See offline-store file content I attached to Bug 468595 Comment #10.
> https://bug468595.bugzilla.mozilla.org/attachment.cgi?id=385987
>  1st mail : text mail
>  2nd mail : partially downloaded pdf part of your test mail
>  3rd mail : fully downloaded your test mail
In addition to "I wanted to say:" of previous comment.
  (G) I couldn't see phenomenon of "Thunderbird can't find the pdf file attachment"
      with Gmail IMAP folder of offline-use=no.
> Do safer way(uninstall/re-install, clean install)
won't that destroy my profile?  

> (A) Not original mail data problem.
I don't understand that.

> (D) I couldn't see "Mail source display" in message pane of three pane window
Neither did I.  I get the mail source with ctrl-u on windows, command-u on Mac.

If the problem was caused by in complete download, then why did it happen on 
two different systems, and why doesn't it go away?  e.g. if i restart TB and download it again?
Once you stop looking at the shiny, what you have on OS X is a directory named /Applications/Thunderbird.app/ full of files, and when you open the .dmg and drag the directory in it named Thunderbird.app/ (which is what's hiding behind the icon) into /Applications/, you're replacing the entire directory with a new one.

See for yourself by right-clicking Thunderbird.app, "Show Package Contents", then copy-paste a random file into it, and Show Package Contents again after you drag-drop a new one from the .dmg over it, you'll see your file's gone. If you feel better about it, you can trash /Applications/Thunderbird.app before dragging in the new one, it won't destroy your profile, which is in ~/Library/Thunderbird/, any more than deleting C:\Program Files\Mozilla Thunderbird\ would affect your profile on Windows.
I could see some version of data in Cache directory. If partial version is somehow kept, and if the cached data is not expired, I think situation is same as partial offline-store data.

> Cache directory used by Tb.
> C:\Documents and Settings\wada\Local Settings\Application Data\Thunderbird\Profiles\wxkq5msh.Gmail-IMAP\Cache
(0) Delete all files in Cache directory, restart Tb
    Create a Gmail IMAP folder, copy the test mail on folder
(1) Click the mail
    Next file was generated(PDF part is partial)
    (A) 2009/07/03  12:53            50,942 150B38CBd01
(2) Double Click of PDF attachment(Open with Adobe Reader)
    Next file was generated(text/plain & text/html part is partial)
    (B) 2009/07/03  12:53           134,864 3F175572d01
(3) Double Click of Part 1.3(Open with Notepad.exe)
    Next file was generated(whole data version)
    (C) 2009/07/03  12:54           179,379 150B38CBd02
(4) Terminate Tb
    Next file only was kept
    (B) 2009/07/03  12:53           134,864 3F175572d01
    Next two files were deleted
    (A) 2009/07/03  12:53            50,942 150B38CBd01
    (C) 2009/07/03  12:54           179,379 150B38CBd02
Why whole data version(C) is not kept?
As I wrote in Bug 468637 Comment #10, I could produce partial mail data in offline-store using your test mail, without utilizing known bug. In that case, "partial mail data" is for JPEG file, then data for PDF is not held in offline-store file. So phenomenon of "can't find the pdf file attachment" is also observed.

Nelson, is your case offline-use=Off case? Or offline-use=On case?
(Sorry but I couldn't find your answer for it in this bug...)
Blocks: 468595
No longer depends on: 468595
FYI.

For "Mail source display at message pane":
Sm/Tb has problem of Bug 506504. If you touched View/Character Encoding menu, "Mail source display at message pane" could occur. Phenomenon of Bug 506504 could occur in older builds without touching View/Character Encoding menu, because problems around auto-detect or character encoding handling would cause similar situation to Bug 506504.
Following is copy of your Bug 499408 Comment #8.
> On my Windows PC system, ALL my IMAPS folders are set for offline use.
> On my Mac laptop, NONE of my IMAPS folders are set for offline use.
No need of answer to comment #15.
(Off-Topic)
Nelson, test mail you attached to this bug is "IPS cells" for me :-)
> http://en.wikipedia.org/wiki/Induced_pluripotent_stem_cell
It generated Bug 498473. It also generated many phenomena reported to bugs currently listed in Dependency Tree for Bug 468595, as seen in my comments to this bug.
> Nelson, test mail you attached to this bug is "IPS cells" for me :-)
I hope that's a good thing!  (is it?)
No longer blocks: 468595
Depends on: 468595
Bug 468595 is already fixed. (See Bug 468595 Comment #55 for checkin id)
Can you reproduce your problem with newest trunk nightly build?
> http://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-comm-1.9.1/
> http://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-comm-1.9.1-l10n/
> If MS Win, download win32.zip build. You can test by UNZIP only.
Checked with next build, using test mail of this bug.
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4pre) Gecko/20090909 Shredder/3.0b4pre

(1) "Can't find attachment" in bug summary.
    Unable to reproduce the problem. Any attachment can be viewd.
(2) "This body part will be downloaded on demand." as message body,
    even though View/Message Body As/Original HTML, and display as attachment of
    jpeg and text part for HTML.
    This problem still occurs.
    If mail is viewed sometimes, offline-store size increases.
    Mail data in offline-store is not corrupted,
    But offline-store size is decreased by (mail size)*N when "Compact".
    It indicates data is written in offline-store correctly,
    but Tb fails to process data in offline-store properly.

To Nelson Bolyard(bug opener):

I think original problem of this bug(corrupted offline-store data, then loss of attachment data) is already resolved by some changes and fix of Bug 468595.
I'll open separate bug for above (2), using "IPS cells" provided by you :-).
(In addition to comment #21)
Above (2) was problem when the mail was downloaded by viewing of mail with "Display Attchments Inline"=Off. If the mail is viewed with "Display Attchments Inline"=On and downloaded to offline-store, mail is displayed as expected.
One more addition. "Remove of the mail from offline-store" is always seen for the test mail. It looks for me mixture of, (a) quirks for mail of not-so-well-structured-for-Tb, (b) Tb's inappropriate determination on "mail-body or attachment", (c) offline-store feature's intolerance with such quirks or inappropriate logic.

Anyway, I close this bug as FIXED(fixed by Bug 468595). Nelson, please re-open or open separate bug, if you'll find problem even after fix of Bug 468595.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by bug 468595]
I've opened Bug 516211 for problem of Comment #21 to 23.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: