Closed Bug 268459 Opened 17 years ago Closed 15 years ago
Search / filters for Message Body broken for quoted-printable bodies
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 Build Identifier: version 0.9 (20041103) Searching messages bodies for plain text messages encoded using quoted-printable will not generate proper results, many messages will be missed. The cause seems to be the fact that a literal search is performed on the message body without first decoding the content. In quoted-printable lines are wrapped and the = sign is used to mark a continuation. If the string you are searching for happens to be split across two lines then it will not be found. Reproducible: Always Steps to Reproduce: 1. Identify some text message encoded using quoted-printable 2. Look for some string that is wrapped using = as a contonuation marker 3. Search for that string Actual Results: The message is not found Expected Results: It should be found Here is an example: ========================================================================== Subject: Production Errors Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_330_3090970.1099946048164" ------=_Part_330_3090970.1099946048164 Content-Type: text/plain; charset=Cp1252 Content-Transfer-Encoding: quoted-printable 2004-11-08 12:34:04,773 DEBUG [LanguageCache.getLanguage(Line 140)] Could n= ot find language for locale: en_US. Using language code en to find the lang= uage. ========================================================================== Searching for "Could not find language" or "find the language." will not produce this message.
Reproduced with TB version 0.9+ (20041112), and also Moz 1.8a5.
Assignee: mscott → sspitzer
Severity: major → normal
Status: UNCONFIRMED → NEW
Component: General → Search
Ever confirmed: true
Product: Thunderbird → MailNews
Summary: Search Messages broken for quoted-printable bodies → Search Message Body broken for quoted-printable bodies
Version: unspecified → Trunk
Message filters suffer same problem for me (mozilla 1.5 on Solaris2.8), such as (Body contains "=>") fails due to the wrapping issue but also because in quoted-printable an embedded "=" is "=3D". Sorry for some slightly off-topic digression here: Was hoping to find in bugzilla an answer to: Are there UNIX mail filters that can simply cleanse all incoming email, convert quoted-printable to 8-bit absolutely everywhere, even handling attachments)? I've heard of a few (sendmail) but that only do simple single-part email bodies, not multi-part or attachments, thus no use to me. Tempting to request mozilla-mail config option by which it will undo quoted-printable in all incoming emails. I realize this won't fly due to the desire to preserve the incoming emails as-is as much as possible. Likewise any notion of building such conversion into movemail (which I use, built-in) would not fly. But still permits option of a third-party "external" movemail to do so. However I anyway use also use procmail-based filters, also broken by quoted-printable same way as mozilla, thus I'd need a undo-quoted-printable filter that stands alone from mozilla.
*** Bug 293191 has been marked as a duplicate of this bug. ***
tbird has the same problem. cc'ing david / mscott.
Component: MailNews: Search → MailNews: Backend
Product: Mozilla Application Suite → Core
16 years ago
Summary: Search Message Body broken for quoted-printable bodies → Search / filters for Message Body broken for quoted-printable bodies
Similar to this bug, I found that if the Content-Transfer-Encoding is base64 then I also cannot search for plain text in the body of the message. Same problem for the message filters. It seems likely that spammers are using this to get around junk mail filtering. (It prevents me from filtering out email that has certain undesireable websites in it.) I am using Tbird 1.5 Am filing here so that a generic solution to different Content-Transfer-Encoding's can be implemented rather than just for quoted-printable. FYI, an additional complication on the email I am looking at is that charset="iso-2022-jp" but I tried searching and filtering on plain ascii text, so I doubt that this is the reason it didnt work. Just speculating here, but I wonder if spam filtering is able to see into these encoded body parts. Various reports of problems in spam identification, like bug #280716 and bug #284308 both have examples that contain quoted-printable body parts....
Bug 132340 is this same problem, but for base64 instead of q-p.
Assignee: mail → nobody
Component: MailNews: Backend → MailNews: Search
QA Contact: search
Linux too, latest branch build.
OS: Windows 2000 → All
Hardware: PC → All
I believe search at least already goes through the quoted printable decoding; but we weren't dealing with soft line breaks correctly
Assignee: nobody → bienvenu
Status: NEW → ASSIGNED
Attachment #255226 - Flags: superreview?(mscott)
Attachment #255226 - Flags: superreview?(mscott) → superreview+
You're converting an '=' at the end of the line to a space? Is that correct? I thought that was an explicit indicator to concatenate without whitespace; if a space is desired, the line ends with '=20' or else has a space immediately before the '='.
Mike, you could be right - I'll need to find a test message...
thx, Mike - you were right as usual. This patch just eats the soft line break, leaving the space. I've tested this doing a quick search on mesasge body's in a folder looking for a string that spans a quoted printable soft line break and it seems to work fine.
fixed on trunk and branch
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
TB 2b2-0217, this doesn't seem to be working for me. David, I sent you a test message which included these source lines: =========== Uw advertentie staat dan weer bovenaan in de rubriek! Bellers met een Pre= Pay telefoon of een pulse telefoon kunnen geen gebruik maken van deze die= nst. Belgische adverteerders bellen naar: 0903 - 42040. =========== Searching the folder for Body, contains, "prepay" (or "dienst") fails to find the message.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Mike, I know you sent me that message, but I can't find it. Can you resend it? Thx!
Mike, never mind, it was in my junk folder.
Ugh, in the find case, we do decode the QP one line at a time, whereas in the preview text case (the other caller of this code, which now works), we pass in a block of text, including the line endings. So to fix this, I need to change nsMsgSearchTerm::MatchBody to coalesce quoted printable lines that end with '='.
Which again points to the MIME architecture. The q-p text should not be what's getting parsed -- C-T-E should be decoded before search ever gets it.
rewriting body search to go through the mime converter would certainly fix some issues - easy, it isn't.
concatenate lines with QP soft-linebreak before doing search.
Attachment #255828 - Flags: superreview?(mscott)
Attachment #255828 - Flags: superreview?(mscott) → superreview+
last patch landed on trunk and branch.
Status: REOPENED → RESOLVED
Closed: 15 years ago → 15 years ago
Resolution: --- → FIXED
V with 2b2-0221, Win2K. Works in QuickSearch | Entire Message, too. Thanks, David.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.