diff options
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/imap.rb | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index a83f455163..f68fe4551e 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2411,27 +2411,26 @@ module Net match(T_SPACE) param, content_id, desc, enc, size = body_fields - # If this is not message/rfc822, we shouldn't apply the RFC822 spec - # to it. - # We should handle anything other than message/rfc822 using - # multipart extension data [rfc3501] (i.e. the data itself won't be - # returned, we would have to retrieve it with BODYSTRUCTURE instead - # of with BODY - if "#{mtype}/#{msubtype}" != 'MESSAGE/RFC822' then - return BodyTypeExtension.new(mtype, msubtype, - param, content_id, - desc, enc, size) - end - - # Also, sometimes a message/rfc822 is included as a large - # attachment instead of having all of the other details - # (e.g. attaching a .eml file to an email) - token = lookahead - if token.symbol == T_RPAR then - return BodyTypeMessage.new(mtype, msubtype, param, content_id, - desc, enc, size, nil, nil, nil, nil, - nil, nil, nil) + if token.symbol == T_RPAR + # If this is not message/rfc822, we shouldn't apply the RFC822 + # spec to it. We should handle anything other than + # message/rfc822 using multipart extension data [rfc3501] (i.e. + # the data itself won't be returned, we would have to retrieve it + # with BODYSTRUCTURE instead of with BODY + + # Also, sometimes a message/rfc822 is included as a large + # attachment instead of having all of the other details + # (e.g. attaching a .eml file to an email) + if msubtype == "RFC822" + return BodyTypeMessage.new(mtype, msubtype, param, content_id, + desc, enc, size, nil, nil, nil, nil, + nil, nil, nil) + else + return BodyTypeExtension.new(mtype, msubtype, + param, content_id, + desc, enc, size) + end end match(T_SPACE) |