From c3631b32d8b0ca242e2abaa2e4fbf5dcfeb473b6 Mon Sep 17 00:00:00 2001 From: Mahmoud Saada Date: Sun, 2 Aug 2026 12:50:26 -0400 Subject: [PATCH] Revert "Revert "Fix repeat command with odd-sized non-map outputs (#281)" (#282)" This reverts commit 26dd1d2710744e40801602532a2715261ef590a5. --- src/yetibot/core/commands/collections.clj | 7 +++++-- test/yetibot/core/test/commands/collections.clj | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/yetibot/core/commands/collections.clj b/src/yetibot/core/commands/collections.clj index 030d113c..2e89e5bd 100644 --- a/src/yetibot/core/commands/collections.clj +++ b/src/yetibot/core/commands/collections.clj @@ -670,8 +670,11 @@ ;; - others return an error like {:result/error} ;; - others just return a plain value ;; so look for all 3 forms - values (map (fn [{:result/keys [value error] :as arg}] - (or value error arg)) results) + values (map (fn [arg] + (if (map? arg) + (let [{:result/keys [value error]} arg] + (or value error arg)) + arg)) results) data (map :result/data results) ] (info (pr-str (doall results))) diff --git a/test/yetibot/core/test/commands/collections.clj b/test/yetibot/core/test/commands/collections.clj index 2eff4a55..0b00223e 100644 --- a/test/yetibot/core/test/commands/collections.clj +++ b/test/yetibot/core/test/commands/collections.clj @@ -382,4 +382,11 @@ (fact "using 'unquote' collections command, it should always return 'foo\" bar'; pretty sure this is a bug :)" - value => "foo\" bar"))) + value => "foo\" bar")) + + (let [{{:result/keys [value]} :result} + (ci/command-execution-info "repeat 2 range 5" + {:run-command? true})] + (fact + "using 'repeat' collections command on 'range 5' (an odd number of elements), it should succeed and not throw No value supplied" + value => [["0" "1" "2" "3" "4"] ["0" "1" "2" "3" "4"]])))