[Groonga-commit] ranguba/chupa-text-decomposer-mail at 09be492 [master] Support no MIME case

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Mar 1 23:09:42 JST 2017


Kouhei Sutou	2017-03-01 23:09:42 +0900 (Wed, 01 Mar 2017)

  New Revision: 09be492d6d391cd587bc315639b374f1660a67b2
  https://github.com/ranguba/chupa-text-decomposer-mail/commit/09be492d6d391cd587bc315639b374f1660a67b2

  Message:
    Support no MIME case

  Added files:
    test/fixture/no-mime.eml
  Modified files:
    lib/chupa-text/decomposers/mail.rb
    test/test-mail.rb

  Modified: lib/chupa-text/decomposers/mail.rb (+1 -1)
===================================================================
--- lib/chupa-text/decomposers/mail.rb    2017-03-01 22:53:55 +0900 (df5e681)
+++ lib/chupa-text/decomposers/mail.rb    2017-03-01 23:09:42 +0900 (c47896d)
@@ -47,7 +47,7 @@ module ChupaText
 
           part_data = TextData.new(body, :source_data => data)
           part_data.uri = "#{data.uri}\##{i}"
-          part_data.mime_type = part.mime_type
+          part_data.mime_type = part.mime_type if part.mime_type
           part_data[:encoding] = body.encoding.to_s
           yield(part_data)
         end

  Added: test/fixture/no-mime.eml (+6 -0) 100644
===================================================================
--- /dev/null
+++ test/fixture/no-mime.eml    2017-03-01 23:09:42 +0900 (175067b)
@@ -0,0 +1,6 @@
+Subject: Hello
+From: Sender <from �� example.com>
+To: Recipient <to �� example.com>
+Date: Sun, 19 Feb 2017 00:27:55 +0900 (JST)
+
+World

  Modified: test/test-mail.rb (+11 -0)
===================================================================
--- test/test-mail.rb    2017-03-01 22:53:55 +0900 (7b72e4d)
+++ test/test-mail.rb    2017-03-01 23:09:42 +0900 (6bbdbf4)
@@ -152,5 +152,16 @@ class TestMail < Test::Unit::TestCase
         super(fixture_path("multipart.eml"))
       end
     end
+
+    sub_test_case("no MIME") do
+      def test_body
+        assert_equal(["World\n"], decompose.collect(&:body))
+      end
+
+      private
+      def decompose
+        super(fixture_path("no-mime.eml"))
+      end
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index