Bug 1167982 - Do charset detection for all text/* attachments in composition, not just text/plain. r=aceman
authorJorg K <jorgk@jorgk.com>
Thu, 16 May 2019 09:58:42 +0200
changeset 26621 3b0f430eb654186b43e966fb463d9618e52d0cde
parent 26620 e69be81d45d626cf7e810df27cfee08f00e80b89
child 26622 b206f4d87208d47d4a8d928335a217b4e51ff34c
push id15925
push usermozilla@jorgk.com
push dateThu, 16 May 2019 08:11:56 +0000
treeherdercomm-central@6512afbb0b56 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1167982
Bug 1167982 - Do charset detection for all text/* attachments in composition, not just text/plain. r=aceman
mailnews/compose/src/nsMsgAttachmentHandler.cpp
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -455,17 +455,19 @@ DONE:
       m_type = APPLICATION_OCTET_STREAM;
     else
       m_type = TEXT_PLAIN;
   }
   return NS_OK;
 }
 
 nsresult nsMsgAttachmentHandler::PickCharset() {
-  if (!m_charset.IsEmpty() || !m_type.LowerCaseEqualsLiteral(TEXT_PLAIN))
+  if (!m_charset.IsEmpty() ||
+      !StringBeginsWith(m_type, NS_LITERAL_CSTRING("text/"),
+                        nsCaseInsensitiveCStringComparator()))
     return NS_OK;
 
   if (!mTmpFile) return NS_OK;
 
   return MsgDetectCharsetFromFile(mTmpFile, m_charset);
 }
 
 static nsresult FetcherURLDoneCallback(nsresult aStatus,