Skip to content

Commit

Permalink
Use String#start_with? instead of =~ to check a content type value #99
Browse files Browse the repository at this point in the history
  • Loading branch information
azumakuniyuki committed Jan 8, 2018
1 parent 88d7cc0 commit a8eb19e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sisimai/message/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def self.parse(argvs)
mesgformat = (mailheader['content-type'] || '').downcase
ctencoding = (mailheader['content-transfer-encoding'] || '').downcase

if mesgformat =~ %r{text/(?:plain|html);?}
if mesgformat.start_with?('text/plain;') || mesgformat.start_with?('text/html;')
# Content-Type: text/plain; charset=UTF-8
if ctencoding == 'base64' || ctencoding == 'quoted-printable'
# Content-Transfer-Encoding: base64
Expand All @@ -426,7 +426,7 @@ def self.parse(argvs)
end
end

if mesgformat =~ %r|text/html;?|
if mesgformat.start_with?('text/html;')
# Content-Type: text/html;...
bodystring = Sisimai::String.to_plain(bodystring, true)
end
Expand Down

0 comments on commit a8eb19e

Please sign in to comment.