diff --git a/mozilla/mailnews/base/util/nsMsgI18N.cpp b/mozilla/mailnews/base/util/nsMsgI18N.cpp index 196c3e95497..7f3255a8d8b 100644 --- a/mozilla/mailnews/base/util/nsMsgI18N.cpp +++ b/mozilla/mailnews/base/util/nsMsgI18N.cpp @@ -557,10 +557,16 @@ nsMsgI18NParseMetaCharset(nsFileSpec* fileSpec) { static char charset[kMAX_CSNAME+1]; char buffer[512]; - nsInputFileStream fileStream(*fileSpec); *charset = '\0'; + if (fileSpec->IsDirectory()) { + NS_ASSERTION(0,"file is a directory"); + return charset; + } + + nsInputFileStream fileStream(*fileSpec); + while (!fileStream.eof() && !fileStream.failed() && fileStream.is_open()) { fileStream.readline(buffer, 512); diff --git a/mozilla/mailnews/compose/resources/locale/en-US/composeMsgs.properties b/mozilla/mailnews/compose/resources/locale/en-US/composeMsgs.properties index 3da80e51bae..30a243c2d90 100644 --- a/mozilla/mailnews/compose/resources/locale/en-US/composeMsgs.properties +++ b/mozilla/mailnews/compose/resources/locale/en-US/composeMsgs.properties @@ -191,6 +191,10 @@ noIdentities=You don't have any email identities yet. Create one with the Accou ## @name NS_MSG_GENERIC_FAILURE_EXPLANATION 12562=Please verify that your Mail & Newsgroups account settings are correct and try again. +## @name NS_MSG_ERROR_READING_FILE +12563=Error reading file. + + ## @name NS_FOLLOWUPTO_SENDER 12563=The author of this message has requested that responses be sent only to the author. If you also want to reply to the newsgroup, add a new row to the addressing area, choose Newsgroup from the recipients list, and enter the name of the newsgroup. diff --git a/mozilla/mailnews/compose/src/nsMsgCompose.cpp b/mozilla/mailnews/compose/src/nsMsgCompose.cpp index cf9da3cbf72..53bc61bd8f6 100644 --- a/mozilla/mailnews/compose/src/nsMsgCompose.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCompose.cpp @@ -2559,9 +2559,14 @@ nsMsgCompose::LoadDataFromFile(nsFileSpec& fSpec, nsString &sigData) char *readBuf; char *ptr; + if (fSpec.IsDirectory()) { + NS_ASSERTION(0,"file is a directory"); + return NS_MSG_ERROR_READING_FILE; + } + nsInputFileStream tempFile(fSpec); if (!tempFile.is_open()) - return NS_MSG_ERROR_WRITING_FILE; + return NS_MSG_ERROR_READING_FILE; readSize = fSpec.GetFileSize(); ptr = readBuf = (char *)PR_Malloc(readSize + 1); if (!readBuf) diff --git a/mozilla/mailnews/compose/src/nsMsgComposeStringBundle.h b/mozilla/mailnews/compose/src/nsMsgComposeStringBundle.h index 1a7b247a40b..92d7e8a24a7 100644 --- a/mozilla/mailnews/compose/src/nsMsgComposeStringBundle.h +++ b/mozilla/mailnews/compose/src/nsMsgComposeStringBundle.h @@ -112,6 +112,7 @@ private: #define NS_ERROR_SEND_FAILED_BUT_NNTP_OK NS_MSG_GENERATE_FAILURE(12560) #define NS_MSG_ASK_TO_COMEBACK_TO_COMPOSE NS_MSG_GENERATE_SUCCESS(12561) #define NS_MSG_GENERIC_FAILURE_EXPLANATION NS_MSG_GENERATE_SUCCESS(12562) +#define NS_MSG_ERROR_READING_FILE NS_MSG_GENERATE_FAILURE(12563) #endif /* _nsMsgComposeStringBundle_H_ */