diff --git a/backend/windmill-common/src/flows.rs b/backend/windmill-common/src/flows.rs index aa9efea9b2616..9b66cc65ac230 100644 --- a/backend/windmill-common/src/flows.rs +++ b/backend/windmill-common/src/flows.rs @@ -424,7 +424,7 @@ pub enum FlowModuleValue { path: String, #[serde(skip_serializing_if = "Option::is_none")] hash: Option, - #[serde(deserialize_with = "empty_string_as_none")] + #[serde(skip_serializing_if = "Option::is_none")] tag_override: Option, }, Flow { @@ -482,14 +482,6 @@ fn is_none_or_empty(expr: &Option) -> bool { expr.is_none() || expr.as_ref().unwrap().is_empty() } -fn empty_string_as_none<'de, D>(deserializer: D) -> Result, D::Error> -where - D: serde::Deserializer<'de>, -{ - let s: Option = Option::deserialize(deserializer)?; - Ok(s.filter(|s| !s.is_empty())) -} - #[derive(Deserialize)] struct UntaggedFlowModuleValue { #[serde(rename = "type")] @@ -498,7 +490,6 @@ struct UntaggedFlowModuleValue { input_transforms: Option>, path: Option, hash: Option, - #[serde(deserialize_with = "empty_string_as_none")] tag_override: Option, iterator: Option, modules: Option>, diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index 4dacc91d9081d..a1a4fd9904f4b 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -3761,6 +3761,11 @@ async fn script_to_payload( module: &FlowModule, tag_override: &Option, ) -> Result { + let tag_override = if tag_override.as_ref().is_some_and(|x| x.trim().is_empty()) { + None + } else { + tag_override.clone() + }; let (payload, tag, delete_after_use, script_timeout) = if script_hash.is_none() { let (jp, tag, delete_after_use, script_timeout) = script_path_to_payload(script_path, db, &flow_job.workspace_id, Some(true)).await?; diff --git a/frontend/src/lib/components/ModulePreview.svelte b/frontend/src/lib/components/ModulePreview.svelte index 404caf4041e09..dc6005c92a4cf 100644 --- a/frontend/src/lib/components/ModulePreview.svelte +++ b/frontend/src/lib/components/ModulePreview.svelte @@ -75,7 +75,7 @@ script.content, script.language, args, - $flowStore?.tag ?? val.tag_override ?? script.tag + $flowStore?.tag ?? (val.tag_override ? val.tag_override : script.tag) ) } else if (val.type == 'flow') { await testJobLoader?.abstractRun(() =>