Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/net/imap/command_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def send_data(imap, tag) = data.each do _1.send_data(imap, tag) end

def validate
return unless data.last in RawText(data: text)
if text.rindex(/~?\{[1-9]\d*\+?\}\z/n)
if text.rindex(/\{\d+\+?\}\z/n)
raise DataFormatError, "RawData cannot end with literal continuation"
end
end
Expand Down
7 changes: 7 additions & 0 deletions test/net/imap/test_command_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ class RawDataTest < CommandDataTest
assert_raise(DataFormatError) do RawData.new(data: "~literal+ ~{123+}") end
raw = RawData.new(data: " {123} ")
assert_equal [RawText[" {123} "]], raw.data

assert_raise(DataFormatError) do RawData.new(data: "literal {0}") end
assert_raise(DataFormatError) do RawData.new(data: "literal+ {0+}") end
assert_raise(DataFormatError) do RawData.new(data: "~literal ~{0}") end
assert_raise(DataFormatError) do RawData.new(data: "~literal+ ~{0+}") end
raw = RawData.new(data: " {0} ")
assert_equal [RawText[" {0} "]], raw.data
end

data(
Expand Down
Loading