Search / filters for Message Body broken for quoted-printable bodies

VERIFIED FIXED

Status

MailNews Core
Search
VERIFIED FIXED
13 years ago
9 years ago

People

(Reporter: Marius Scurtescu, Assigned: Bienvenu)

Tracking

({fixed1.8.1.2})

Trunk
fixed1.8.1.2

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

13 years ago
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.

Comment 1

13 years ago
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
Product: Browser → Seamonkey

Comment 2

13 years ago
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.

Updated

12 years ago
Assignee: sspitzer → mail
*** 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
Summary: Search Message Body broken for quoted-printable bodies → Search / filters for Message Body broken for quoted-printable bodies

Comment 5

11 years ago
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....

Comment 6

11 years ago
Bug 132340 is this same problem, but for base64 instead of q-p.
Assignee: mail → nobody
Component: MailNews: Backend → MailNews: Search
QA Contact: search

Updated

10 years ago
Blocks: 370090

Comment 7

10 years ago
Linux too, latest branch build.
OS: Windows 2000 → All
Hardware: PC → All
(Assignee)

Comment 8

10 years ago
Created attachment 255226 [details] [diff] [review]
replace soft line break with space

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)

Updated

10 years ago
Attachment #255226 - Flags: superreview?(mscott) → superreview+

Comment 9

10 years ago
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 '='.
(Assignee)

Comment 10

10 years ago
Mike, you could be right - I'll need to find a test message...
(Assignee)

Comment 11

10 years ago
Created attachment 255241 [details] [diff] [review]
eat soft line breaks, don't insert a space

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.
Attachment #255226 - Attachment is obsolete: true
Attachment #255241 - Flags: superreview+
(Assignee)

Comment 12

10 years ago
fixed on trunk and branch
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Keywords: fixed1.8.1.2
Resolution: --- → FIXED

Comment 13

10 years ago
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 → ---
(Assignee)

Comment 14

10 years ago
Mike, I know you sent me that message, but I can't find it. Can you resend it? Thx!
(Assignee)

Comment 15

10 years ago
Mike, never mind, it was in my junk folder.
(Assignee)

Comment 16

10 years ago
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 '='.

Comment 17

10 years ago
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.
(Assignee)

Comment 18

10 years ago
rewriting body search to go through the mime converter would certainly fix some issues - easy, it isn't.
(Assignee)

Comment 19

10 years ago
Created attachment 255828 [details] [diff] [review]
fix search case.

concatenate lines with QP soft-linebreak before doing search.
Attachment #255828 - Flags: superreview?(mscott)

Updated

10 years ago
Attachment #255828 - Flags: superreview?(mscott) → superreview+
(Assignee)

Comment 20

10 years ago
last patch landed on trunk and branch.
Status: REOPENED → RESOLVED
Last Resolved: 10 years ago10 years ago
Resolution: --- → FIXED

Comment 21

10 years ago
V with 2b2-0221, Win2K.  Works in QuickSearch | Entire Message, too.
Thanks, David.
Status: RESOLVED → VERIFIED

Updated

10 years ago
Attachment #255828 - Attachment is patch: true
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.