commit 704b539ce4aab5c8a8b4218f433a0e4edcb74611
parent f05a2113854d84a39cc3ade90bc192f28118c8d9
Author: Steven Lawrance <stl@redhat.com>
Date: Wed, 23 Mar 2011 11:37:53 +1000
Correct over-zealous signature matching
If a message body contains e.g. a table with lines that match the
signature pattern (Bugzilla mails and SQL session pastes are the ones
that irk me) then avoid treating said table as a signature (but only if
the remainder contains a traditional signature too (as a compromise)).
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -615,7 +615,7 @@ private
## like ":a:a:a:a:a" that occurred in certain emails.
if line =~ QUOTE_PATTERN || (line =~ /:$/ && line =~ /\w/ && nextline =~ QUOTE_PATTERN)
newstate = :quote
- elsif line =~ SIG_PATTERN && (lines.length - i) < MAX_SIG_DISTANCE
+ elsif line =~ SIG_PATTERN && (lines.length - i) < MAX_SIG_DISTANCE && !lines[(i+1)..-1].index { |l| l =~ /^-- $/ }
newstate = :sig
elsif line =~ BLOCK_QUOTE_PATTERN
newstate = :block_quote