From 596d5f29466e85a3cb037bf4cba44d1bddda7a73 Mon Sep 17 00:00:00 2001 From: Neil Matatall Date: Tue, 26 Apr 2016 07:51:08 -1000 Subject: [PATCH 1/2] fix regression where gsub! would return nil and omit content --- lib/html/pipeline/email_reply_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/html/pipeline/email_reply_filter.rb b/lib/html/pipeline/email_reply_filter.rb index 9cdb4029..02bbb5cd 100644 --- a/lib/html/pipeline/email_reply_filter.rb +++ b/lib/html/pipeline/email_reply_filter.rb @@ -49,7 +49,7 @@ def call if fragment.quoted? if context[:hide_quoted_email_addresses] pieces.map! do |piece| - piece.gsub!(EMAIL_REGEX, HIDDEN_EMAIL_PATTERN) + piece.gsub(EMAIL_REGEX, HIDDEN_EMAIL_PATTERN) end end pieces.unshift EMAIL_QUOTED_HEADER From 514a221b7aaeae68801be1e60b1b565f1c52eb82 Mon Sep 17 00:00:00 2001 From: Neil Matatall Date: Tue, 26 Apr 2016 07:56:59 -1000 Subject: [PATCH 2/2] add green test from before 2.4 release --- test/html/pipeline/email_reply_filter_test.rb | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/html/pipeline/email_reply_filter_test.rb b/test/html/pipeline/email_reply_filter_test.rb index 29582b32..f603c2c2 100644 --- a/test/html/pipeline/email_reply_filter_test.rb +++ b/test/html/pipeline/email_reply_filter_test.rb @@ -29,4 +29,38 @@ def test_hides_email_addresses_when_configured refute_match %r(boatymcboatface@example.com), doc refute_match %r(alreadyleaked@example.com), doc end + + def test_preserves_non_email_content_while_filtering + str = <<-EMAIL +> Thank you! I have some thoughts on this pull request. +> +> * acme provides cmake and a wrapper for it. Please use '$(TARGET)-cmake' instead of cmake -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' -DCMAKE_BUILD_TYPE=Release. + +Okay -- I'm afraid I just blindly copied the eigen3.mk file, since that's a library I'm familiar with :-) + +> * Do you need -DCMAKE_SYSTEM_PROCESSOR=x86? + +Yes, this is a bit dumb, but vc checks for that (or amd) to determine that it's not being built on ARM. + +-- +Boaty McBoatface | http://example.org +EMAIL + + filter = EmailReplyFilter.new(str, :hide_quoted_email_addresses => true) + doc = filter.call.to_s + + expected = <<-EXPECTED + + + + + +EXPECTED + + assert_equal(expected.chomp, doc) + end end