From e082575a3fe912910c7bec9ddd107ac28734c868 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Fri, 22 Apr 2022 20:20:01 +0000 Subject: [PATCH] fix: std.join/std.flatmap accepts null in array --- --- a/crates/jrsonnet-evaluator/src/builtin/mod.rs +++ b/crates/jrsonnet-evaluator/src/builtin/mod.rs @@ -410,6 +410,7 @@ for c in str.chars() { match func.evaluate_simple(s.clone(), &[c.to_string()].as_slice())? { Val::Str(o) => out.push_str(&o), + Val::Null => continue, _ => throw!(RuntimeError( "in std.join all items should be strings".into() )), @@ -427,6 +428,7 @@ out.push(oe?); } } + Val::Null => continue, _ => throw!(RuntimeError( "in std.join all items should be arrays".into() )), @@ -564,6 +566,8 @@ for item in items.iter(s.clone()) { out.push(item?); } + } else if matches!(item, Val::Null) { + continue; } else { throw!(RuntimeError( "in std.join all items should be arrays".into() @@ -585,6 +589,8 @@ } first = false; out += &item; + } else if matches!(item, Val::Null) { + continue; } else { throw!(RuntimeError( "in std.join all items should be strings".into() -- gitstuff