From 6dec4479537164fe17bea7f88fd60b1d4f42e887 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 28 Jul 2022 12:59:14 +0200 Subject: [PATCH] fix: if :path is not a valid path, do not even attempt to fetch it --- backend/src/worker.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/worker.rs b/backend/src/worker.rs index 67bc9d8bab..dc16c7dbd6 100644 --- a/backend/src/worker.rs +++ b/backend/src/worker.rs @@ -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()