Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Follow #434 Sisimai::RFC2045.haircut should return ["",""] when lower…
…chunk is nil to avoid SystemStackError
  • Loading branch information
azumakuniyuki committed Jun 8, 2026
commit a007f6c6ecbc4367661750557360533c966be557
3 changes: 1 addition & 2 deletions lib/sisimai/rfc2045.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ def haircut(block = '', heads = false)
return nil if block.empty?

(upperchunk, lowerchunk) = block.split("\n\n", 2)
return ['', ''] if upperchunk.nil? || upperchunk.empty?
return ['', ''] if upperchunk.nil? || upperchunk.empty? || lowerchunk.nil?
return ['', ''] if upperchunk.index('Content-Type').nil?
lowerchunk = '' if lowerchunk.nil?

headerpart = ['', ''] # ["text/plain; charset=iso-2022-jp; ...", "quoted-printable"]
multipart1 = [] # [headerpart, "body"]
Expand Down