Skip to content

Don't interpret signature delimiter in the middle of line as signature #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/email_reply_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def read(text)

private
EMPTY = "".freeze
SIGNATURE = '(?m)(--|__|\w-$)|(^(\w+\s*){1,3} ym morf tneS$)'
SIGNATURE = '(?m)^(--|__|\w-$)|(^(\w+\s*){1,3} ym morf tneS$)'

begin
require 're2'
Expand Down
5 changes: 5 additions & 0 deletions test/email_reply_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ def test_pathological_emails
assert (Time.now - t0) < 1, "Took too long, upgrade to re2 gem."
end

def test_doesnt_remove_signature_delimiter_in_mid_line
reply = email(:email_sig_delimiter_in_middle_of_line)
assert_equal 1, reply.fragments.size
end

def email(name)
body = IO.read EMAIL_FIXTURE_PATH.join("#{name}.txt").to_s
EmailReplyParser.read body
Expand Down
7 changes: 7 additions & 0 deletions test/emails/email_sig_delimiter_in_middle_of_line.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Hi there!

Stuff happened.

And here is a fix -- this is not a signature.

kthxbai