EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
automation: an array where the output goes is no output either (#2479)
Anubhav Rai80a33f0e8627
diff --git a/crates/automation/src/confine.rs b/crates/automation/src/confine.rsindex d9807ca40..ce6717f30 100644--- a/crates/automation/src/confine.rs+++ b/crates/automation/src/confine.rs@@ -169,8 +169,9 @@ impl Confinement {(None, None) => (&[][..], Access::Read),};let mut given = false;- // Whether one of them is a file and not a Render Queue template, whose own output is- // relative and resolved like one the agent never gave.+ // Whether one of them is a file: not a Render Queue template, whose own output is relative+ // and resolved like one the agent never gave, and not an array, which the commands that+ // take a single output read as nothing at all.let mut gave_a_file = false;for key in named {let Some(v) = params.get(*key).filter(|v| !v.is_null()) else { continue };@@ -184,7 +185,7 @@ impl Confinement {match p.as_str() {Some(s) if id == "render.preRender" && !looks_like_path(s) => {}Some(s) => {- gave_a_file = true;+ gave_a_file |= v.is_string();self.check(s, access)?;}None => return Err(Error::BadArgs(format!("`{id}`: `{key}` must be a path"))),diff --git a/crates/automation/src/tests.rs b/crates/automation/src/tests.rsindex 3c5620fbf..61a726d6b 100644--- a/crates/automation/src/tests.rs+++ b/crates/automation/src/tests.rs@@ -1402,6 +1402,10 @@ fn automation_roots_refuse_a_queued_output_from_an_unsaved_project() {let msg = c[0]["text"].as_str().unwrap_or_default();assert!(msg.contains("the project has no file yet"), "`{command}`: {msg}");}+ // An array where a path goes: the engine reads a scalar, so this is no output either.+ let (c, err) = call(&mut s, "execute_command", json!({"command": "file.createProxy", "params": {"comp": "A", "path": [p("arr.mov")]}}));+ assert!(err, "an array where the output goes should be refused: {c:?}");+ assert!(c[0]["text"].as_str().unwrap_or_default().contains("the project has no file yet"), "{c:?}");// Naming an Output Module template instead of a file is the same: its own output is relative.let (c, err) = call(&mut s, "execute_command", json!({"command": "render.preRender", "params": {"comp": "A", "output": "Lossless"}}));assert!(err, "a template output should be refused too: {c:?}");