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: 2 additions & 0 deletions lib/net/imap/command_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ def validate
or raise DataFormatError, "#{self.class} must be ASCII only"
data.match?(ResponseParser::Patterns::ATOM_SPECIALS) \
and raise DataFormatError, "#{self.class} must not contain atom-specials"
data.empty? \
and raise DataFormatError, "#{self.class} must not be empty"
end

def send_data(imap, tag)
Expand Down
2 changes: 2 additions & 0 deletions test/net/imap/test_command_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def send_data(*data, tag: TAG)
"with_quoted_specials\\",
"with\rCR",
"with\nLF",
"", # empty
].each do |symbol|
assert_raise_with_message(Net::IMAP::DataFormatError, /\batom\b/i) do
imap.send_data Atom[symbol]
Expand Down Expand Up @@ -116,6 +117,7 @@ def send_data(*data, tag: TAG)
:"with_quoted_specials\\",
:"with\rCR",
:"with\nLF",
:"", # empty
].each do |symbol|
assert_raise_with_message(Net::IMAP::DataFormatError, /\bflag\b/i) do
imap.send_data Flag[symbol]
Expand Down
Loading