File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11BLADE_BUCKET_REGION = 'ap-northeast-1'
22BLADE_BUCKET_NAME = 'blade.ruby-lang.org'
33
4+ require 'kconv'
5+
46class Message < ApplicationRecord
57 # Not really sure we will utlize this configuration,
68 # but I don't want to make this column.
@@ -19,8 +21,14 @@ def self.from_s3(list_name, list_seq)
1921 end
2022
2123 def self . from_string ( str )
22- hs , body = str . encode ( 'utf-8' , invalid : :replace ) . split ( /\n \n / , 2 )
23- headers = hs . split ( /\n / ) . map { |line |
24+ headers_str , body = str . split ( /\n \n / , 2 )
25+
26+ # Not really sure this is from the original email, or while making
27+ # blade.ruby-lang.org's S3 archive, but there are emails without
28+ # a proper Form header, such as ruby-list:2840.
29+ headers_str = Kconv . toutf8 ( headers_str ) . gsub ( /\r \n / , '' )
30+
31+ headers = headers_str . split ( /\n / ) . map { |line |
2432 line . split ( /:\s +/ , 2 )
2533 } . to_h
2634
You can’t perform that action at this time.
0 commit comments