Fix for bug 83184. Need to send resource fork of file which Internet config doesn't have a mapping for. This fix has been already checked in the 0.9.1 branch. R=sfraser, SR=bienvenu, A=asa

This commit is contained in:
ducarroz%netscape.com 2001-06-04 02:44:13 +00:00
parent 358a2b68ed
commit af4453cc6c

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); extern void MacGetFileType(nsFileSpec *fs, PRBool *useDefault, char **type, char **encoding);
#include "MoreFilesExtras.h"
#include "nsIInternetConfigService.h" #include "nsIInternetConfigService.h"
#endif /* XP_MAC */ #endif /* XP_MAC */
@ -605,7 +606,16 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
if (! icGaveNeededInfo) if (! icGaveNeededInfo)
{ {
// If InternetConfig cannot help us, then just try our best... // 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); nsAutoString urlStr; urlStr.AssignWithConversion(url_string);
char *ext = nsMsgGetExtensionFromFileURL(urlStr); char *ext = nsMsgGetExtensionFromFileURL(urlStr);
if (ext && *ext) if (ext && *ext)
@ -624,6 +634,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
PL_strcasecmp(ext, "JS"); PL_strcasecmp(ext, "JS");
} }
PR_FREEIF(ext); PR_FREEIF(ext);
}
} }
// Only use appledouble if we aren't uuencoding. // Only use appledouble if we aren't uuencoding.