Bug 1427124 - Follow-up: charset can be quoted. r=aceman a=jorgk
authorJorg K <jorgk@jorgk.com>
Wed, 03 Jan 2018 01:13:33 +0100
changeset 28135 c4f66e88dd7eca6a15335f409c6ac09d9e1f2fce
parent 28134 505cb876ef79f19e39bd073e4943c8909ff5e044
child 28136 5408e66d3962ac342472653d0428879606279d6d
push id2014
push usermozilla@jorgk.com
push dateTue, 16 Jan 2018 19:58:04 +0000
treeherdercomm-esr52@c4f66e88dd7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, jorgk
bugs1427124
Bug 1427124 - Follow-up: charset can be quoted. r=aceman a=jorgk
mailnews/base/search/src/nsMsgBodyHandler.cpp
--- a/mailnews/base/search/src/nsMsgBodyHandler.cpp
+++ b/mailnews/base/search/src/nsMsgBodyHandler.cpp
@@ -428,17 +428,22 @@ void nsMsgBodyHandler::SniffPossibleMIME
     if (!m_boundaries.Contains(boundary))
       m_boundaries.AppendElement(boundary);
   }
 
   if (m_isMultipart &&
       (start = lowerCaseLine.Find("charset=", CaseInsensitiveCompare)) != -1)
   {
     start += 8;  // strlen("charset=")
-    int32_t end = line.RFindChar(';');
+    bool foundQuote = false;
+    if (line[start] == '\"') {
+      start++;
+      foundQuote = true;
+    }
+    int32_t end = line.FindChar(foundQuote ? '\"' : ';', start);
     if (end == -1)
       end = line.Length();
 
     m_partCharset.Assign(Substring(line, start, end-start));
   }
 
   if (StringBeginsWith(lowerCaseLine,
                        NS_LITERAL_CSTRING("content-transfer-encoding:")) &&