class Net::IMAP::BodyTypeAttachment
WARNING¶ ↑
BodyTypeAttachment represents a body-fld-dsp that is incorrectly in a position where the IMAP4rev1 grammar expects a nested body structure.
IMAP body structures are parenthesized lists and assign their fields positionally, so missing fields change the intepretation of all following fields. Buggy IMAP servers sometimes leave fields missing rather than empty, which inevitably confuses parsers.
BodyTypeAttachmentwas an attempt to parse a common type of buggy body structure without crashing.Currently, when
Net::IMAP::ResponseParsersees “attachment” as the first entry in abody-type-1part, which is where the MIME type should be, it usesBodyTypeAttachmentto capture the rest. “attachment” is not a valid MIME type, but is a commonContent-Disposition. What might have happened was that buggy server could not parse the message (which might have been incorrectly formatted) and output abody-type-dspwhere aNet::IMAP::ResponseParserexpected to see abody.
A future release will replace this, probably with a ContentDisposition nested inside another body structure object, maybe BodyTypeBasic, or perhaps a new body structure class that represents any unparsable body structure.
Public Instance Methods
Returns the content disposition type, as defined by [DISPOSITION].
# File net-imap-0.3.4/lib/net/imap/response_data.rb, line 1174
*invalid for BodyTypeAttachment*
# File net-imap-0.3.4/lib/net/imap/response_data.rb, line 1160 def media_type warn(<<~WARN, uplevel: 1) BodyTypeAttachment#media_type is obsolete. Use dsp_type instead. WARN dsp_type end
# File net-imap-0.3.4/lib/net/imap/response_data.rb, line 1188 def multipart? return false end
Returns a hash representing parameters of the Content-Disposition field, as defined by [DISPOSITION].
# File net-imap-0.3.4/lib/net/imap/response_data.rb, line 1181
*invalid for BodyTypeAttachment*
# File net-imap-0.3.4/lib/net/imap/response_data.rb, line 1168 def subtype warn("BodyTypeAttachment#subtype is obsolete.\n", uplevel: 1) nil end