Skip to content

Commit d31ecf7

Browse files
committed
✨ Coerce :* search args into sequence-set
1 parent 2db20a7 commit d31ecf7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/net/imap.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ def uid_expunge(uid_set)
19471947
# These types are converted to SequenceSet for validation and encoding:
19481948
# * +Set+
19491949
# * +Range+
1950-
# * <tt>-1</tt> translates to <tt>*</tt>
1950+
# * <tt>-1</tt> and +:*+ -- both translate to <tt>*</tt>
19511951
# * nested +Array+
19521952
# * Any +String+ is sent verbatim when it is a valid \IMAP atom,
19531953
# and encoded as an \IMAP quoted or literal string otherwise.
@@ -3205,7 +3205,7 @@ def normalize_searching_criteria(criteria)
32053205

32063206
def coerce_search_arg_to_seqset?(obj)
32073207
case obj
3208-
when Set, -1 then true
3208+
when Set, -1, :* then true
32093209
when Range then true
32103210
when Array then true
32113211
else false

test/net/imap/test_imap.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,9 @@ def test_unselect
12271227
imap.search(["subject", "hello", Set[1, 2, 3, 4, 5, 8, *(10..100)]])
12281228
assert_equal "subject hello 1:5,8,10:100", server.commands.pop.args
12291229

1230+
imap.search([:*])
1231+
assert_equal "*", server.commands.pop.args
1232+
12301233
server.on "UID SEARCH", &search_resp
12311234
assert_equal search_result, imap.uid_search(["subject", "hello",
12321235
[1..22, 30..-1]])

0 commit comments

Comments
 (0)