File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,14 @@ def self.from_s3(list_name, list_seq)
2121 end
2222
2323 def self . from_string ( str )
24- headers_str , body = str . split ( /\n \n / , 2 )
24+ # There are a few hacks to import messages from blade.ruby-lang.org's
25+ # S3 bucket.
2526
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.
27+ # Need to call String#b. There are messages that have headers in non-UTF8,
28+ # but the body is in UTF-8, such as ruby-list:2882.
29+ headers_str , body = str . b . split ( /\n \n / , 2 )
30+
31+ # ruby-list:2840 doesn't have a proper From header.
2932 headers_str = Kconv . toutf8 ( headers_str ) . gsub ( /\r \n / , '' )
3033
3134 headers = headers_str . split ( /\n / ) . map { |line |
Original file line number Diff line number Diff line change 1414 message = Message . from_s3 ( list , seq )
1515 message . save
1616 rescue ActiveRecord ::RecordNotUnique
17- STDERR . puts ( "#{ list } :#{ seq } already exists" )
17+ STDERR . puts ( "#{ list } :#{ seq } already exists in Postgres " )
1818 rescue Aws ::S3 ::Errors ::NoSuchKey
19- STDERR . puts ( "#{ list } :#{ seq } doesn't exist" )
20- rescue
21- STDERR . puts ( "failed to import #{ list } :#{ seq } " )
19+ STDERR . puts ( "#{ list } :#{ seq } doesn't exist in S3 " )
20+ rescue StandardError => e
21+ STDERR . puts ( "failed to import #{ list } :#{ seq } : #{ e } " )
2222 end
2323end
You can’t perform that action at this time.
0 commit comments