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
This commit is contained in:
ducarroz%netscape.com
2001-06-01 05:04:32 +00:00
parent 4fedbb8b9d
commit 2ed9697685

View File

@@ -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.