fix: if :path is not a valid path, do not even attempt to fetch it

This commit is contained in:
Ruben Fiszel
2022-07-28 12:59:14 +02:00
parent eafde7317e
commit 6dec447953
+3
View File
@@ -268,6 +268,9 @@ async fn transform_json_value(token: &str, workspace: &str, base_url: &str, v: V
}
Value::String(y) if y.starts_with("$res:") => {
let path = y.strip_prefix("$res:").unwrap();
if path.split("/").count() < 2 {
return Value::String(format!("resource path: {path} is ill-defined"));
}
let v = crate::client::get_resource(workspace, path, token, base_url)
.await
.ok()