lib/rex/mime/message.rb in rex-mime-0.1.9 vs lib/rex/mime/message.rb in rex-mime-0.1.10
- old
+ new
@@ -24,19 +24,19 @@
self.header.parse(head)
ctype = self.header.find('Content-Type')
if ctype && ctype[1] && ctype[1] =~ /multipart\/mixed;\s*boundary="?([A-Za-z0-9'\(\)\+\_,\-\.\/:=\?^\s]+)"?/
self.bound = $1
- chunks = body.to_s.split(/--#{self.bound}(--)?\r?\n/)
+ chunks = body.to_s.split(/--#{self.bound}(--)?\r?\n?/)
self.content = chunks.shift.to_s.gsub(/\s+$/, '')
self.content << "\r\n" unless self.content.empty?
chunks.each do |chunk|
break if chunk == "--"
head,body = chunk.split(/\r?\n\r?\n/, 2)
part = Rex::MIME::Part.new
part.header.parse(head)
- part.content = body.gsub(/\s+$/, '')
+ part.content = body&.delete_suffix("\r\n")
self.parts << part
end
else
self.content = body.to_s.gsub(/\s+$/, '') + "\r\n"
end