Closed Bug 229855 Opened 21 years ago Closed 21 years ago

check filename extension before Appledouble-encoding attachment having insignificant resource fork

Categories

(MailNews Core :: Attachments, defect)

PowerPC
macOS
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: mozilla.org, Assigned: mscott)

References

()

Details

Attachments

(1 file)

On Mac OS X, when determining whether to Appledouble-encode the resource fork of
an attachment, Mozilla and Thunderbird (as of Thunderbird 20031231) look up the
file type and creator codes in the Internet Config database to determine whether
the resource fork is significant. Mozilla should actually look up the filename
extension first, and then go to the file type and creator only as a backup,
because in Mac OS X the filename extension takes precedence over the file type. See:

http://developer.apple.com/technotes/tn/tn2017.html

Currently, Mozilla sometimes unnecessarily Appledouble-encodes the resource
forks of Microsoft Word .doc files because these files use various type codes,
such as WDBN, W6BN, and W8BN.

Based on a cursory look at the code, I am guessing that this could be fixed
fairly easily by changing PR_FALSE to PR_TRUE in the line

nsresult rv = icService->GetFileMappingFlags(&fsSpec, PR_FALSE, &icFlags);

http://lxr.mozilla.org/seamonkey/source/mailnews/compose/src/nsMsgAttachmentHandler.cpp#716
Some users reported problem in display of multipart/appledouble which is created
for ".doc" file attachment by Thunderbird when mail.file_attach_binary=true.
See http://forums.mozillazine.org/viewtopic.php?t=39285&highlight=appledouble
re: comment 1 - it seems fixing this bug would help those users by avoiding use
of Appledouble in the first place, but it would not fix whatever is causing the
Appledouble encoding to be done incorrectly when Appledouble is used.
To Comment #2 : 

According to post by mscott in the thread in Mozillazine forum I mentioned,
creation of Appledouble-encode can be avoided by changing
mail.file_attach_binary=false (Thunderbird default is true).
According to your comment #2, if this bug will be fixed, creation of
Appledouble-encode for ".doc" will not be done even when
mail.file_attach_binary=true.
There is Bug 229879, which is for problem in displaying received
Appledouble-encode mail.
You say Bug 229879 is different and independent problem?

I do not know whether Appledouble-encode mail created for ".doc" by Mozilla or
Thunderbird is correct format or not.
If incorrect format, you say incorrect format problem will not be resolved by
this bug?
re: comment 3: bug 229879 seems to be different. Bug 229879 describes a problem
reading messages, whereas this bug is a problem composing messages.

Using user_pref("mail.file_attach_binary", false) allows Thunderbird to do the
Appledouble encoding correctly, but the problem is Thunderbird should not be
using Appledouble encoding. Under the default OS settings, Thunderbird should
not encode .doc files using Appledouble. It should simply discard the resource
fork of a .doc file and encode the data fork using base64.
I understand that Bug 229879 is different.

> but the problem is Thunderbird should not be using Appledouble encoding.
>  Under the default OS settings, Thunderbird should not encode .doc files using
Appledouble.
> It should simply discard the resource fork of a .doc file and encode the data
fork using base64.

Why?
"mail.file_attach_binary=true" on Mac seems to mean "use of AppleDouble encoding".
Since resource folk is also required, AppleDouble encoding is introduced.
AppleDouble is usually required for mac user to mac user file transmission.
I think AppleDouble should be used for any files if user requested.

I think followings are required actions.
(1) Change deafult to mail.file_attach_binary=false true to avoid unwanted
sending of AppleDouble because AppleDouble is not suported by all mailers,
especcially in MS Windows world.
(2) Solve incorrect format AppleDouble mail problem if Moziila/Thunderbird
creates incorrect format AppleDouble mail.
(This problem seemd to be resolved already on Thundebird 2003-12-10 build)
(3) Solve problem in displaying AppleDouble mail - Bug 229879.
Re Comment 6: Appledouble should only be used when it is necessary to preserve
the resource fork data of the attached file. Mac OS X Internet Config keeps a
record of which file types need resource fork data and should be encoded as
Appledouble. Mozilla is designed to use Appledouble only with files of these
types, and Microsoft Word .doc files are not among them--all the significant
data in a .doc file is in the data fork, so Appledouble is not necessary.

To avoid adding too much clutter to this bug, please refer to the Mozilla source
code or the Apple developer site developer.apple.com if you have questions about
this.
I now understand this bug.
Sorry for my cluttering and thank you for your descrition.
taking. If the fix looks as easy as it sounds, I might to force this into the
0.5 thunderbird branch. But would need OSX testing help verifying that the fix
works.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.7alpha
Attached patch the fixSplinter Review
I think this is as straightforward as pidgin said it would be....

Do you think this will help fix some of the issues reported:

http://forums.mozillazine.org/viewtopic.php?t=39285

There are so many things going on in that thread, it's hard to figure out
what's going on :)
Assignee: sspitzer → mscott
Attachment #140754 - Flags: superreview?(bienvenu)
Blocks: 230700
Attachment #140754 - Flags: superreview?(bienvenu) → superreview+
checked into the trunk and the M4 branch. I hope this helps some of the issues
we are having with apple/double and sending messages. Looks like Bug #208196 and
Bug #229879 are still issues.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Yes, Thunderbird 0.5b encodes .doc files correctly.  The only "problem" is that,
when double-clicking the attachment, it does not know that it should use
Microsoft Word to open the file.  This is different from other Microsoft Office
documents, such as .xls and .ppt files.  I can solve the "problem" by including
the file type explicitly in Preferences.  So, it is not such a deal from my
(i.e., user's) point of view.
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: