From 2ed9697685f72c07820676de8b71c78ae82d0bfd Mon Sep 17 00:00:00 2001 From: "ducarroz%netscape.com" Date: Fri, 1 Jun 2001 05:04:32 +0000 Subject: [PATCH] Fix for bug 83184. If we cannot figure out if we need to send or not the resource fork, just do it, send it! R=sfraser, SR=bienvenu, A=asa@mozilla.org git-svn-id: svn://10.0.0.236/branches/MOZILLA_0_9_1_BRANCH@96167 18797224-902f-48f8-a5cc-f745e15eee43 --- .../mailnews/compose/src/nsMsgAttachmentHandler.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp index 589561b63fa..a0c05a48a22 100644 --- a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp +++ b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp @@ -53,6 +53,7 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); extern void MacGetFileType(nsFileSpec *fs, PRBool *useDefault, char **type, char **encoding); +#include "MoreFilesExtras.h" #include "nsIInternetConfigService.h" #endif /* XP_MAC */ @@ -605,7 +606,16 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields) if (! icGaveNeededInfo) { // If InternetConfig cannot help us, then just try our best... - sendResourceFork = PR_FALSE; + long dataSize = 0; + long resSize = 0; + + // first check if we have a resource fork + if (::FSpGetFileSize(&fsSpec, &dataSize, &resSize) == noErr) + sendResourceFork = (resSize > 0); + + // then, if we have a resource fork, check the filename extension, maybe we don't need the resource fork! + if (sendResourceFork) + { nsAutoString urlStr; urlStr.AssignWithConversion(url_string); char *ext = nsMsgGetExtensionFromFileURL(urlStr); if (ext && *ext) @@ -624,6 +634,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields) PL_strcasecmp(ext, "JS"); } PR_FREEIF(ext); + } } // Only use appledouble if we aren't uuencoding.