Plot: an unknown extension needs a real format selector (review on #2585)

device None and a null or unknown output no longer bypass the refusal
and write a PDF under the odd name; only a recognised output or a
device that resolves does. Test: plot_path_extension_picks_the_format_like_export.
This commit is contained in:
SBaksa
2026-11-01 22:20:10 +11:00
parent 0e871873e7
commit d6555e5bdf
2 changed files with 12 additions and 2 deletions
+2 -2
View File
@@ -300,8 +300,8 @@ pub(crate) fn plot_options(s: &Session, p: &Value, cmd: &str) -> Result<Value> {
// refuse it, as EXPORT does, unless `output` or a device says what to write.
if cmd == "plot"
&& by_path.is_none()
&& p.get("output").is_none()
&& !given.is_some_and(|n| !n.is_empty())
&& !p.get("output").and_then(Value::as_str).is_some_and(|o| PlotOutput::parse(o).is_some())
&& !(dev.is_some() && given.is_some_and(|n| !n.is_empty()))
&& let Some(path) = str_param(p, "path")
{
return Err(bad(