From 6e21c5afb13bd0ac57768b7fc1b3b48af08f129b Mon Sep 17 00:00:00 2001 From: Gordon Woodhull Date: Fri, 25 Jul 2025 10:49:51 -0400 Subject: [PATCH] processValue recurse with needed debug info fixes #13128 --- news/changelog-1.8.md | 1 + src/resources/filters/quarto-pre/shortcodes-handlers.lua | 2 +- tests/docs/smoke-all/shortcodes/meta-bad-data.qmd | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/docs/smoke-all/shortcodes/meta-bad-data.qmd diff --git a/news/changelog-1.8.md b/news/changelog-1.8.md index 353ea23ff52..10dcd0d2841 100644 --- a/news/changelog-1.8.md +++ b/news/changelog-1.8.md @@ -76,6 +76,7 @@ All changes included in 1.8: - ([#12727](https://github.com/quarto-dev/quarto-cli/issues/12727)): Do not crash in the presence of malformed tabset contents. - ([#12806](https://github.com/quarto-dev/quarto-cli/pull/12806)): Use pandoc APIs to handle codepage conversion on Windows. - ([#12811](https://github.com/quarto-dev/quarto-cli/pull/12811)): Add support for YouTube Shorts in `video` shortcode. +- ([#13128](https://github.com/quarto-dev/quarto-cli/issues/13128)): Meta shortcode could crash on bad input. ## Commands diff --git a/src/resources/filters/quarto-pre/shortcodes-handlers.lua b/src/resources/filters/quarto-pre/shortcodes-handlers.lua index 5387db9f355..ce75e5b1a96 100644 --- a/src/resources/filters/quarto-pre/shortcodes-handlers.lua +++ b/src/resources/filters/quarto-pre/shortcodes-handlers.lua @@ -287,7 +287,7 @@ function processValue(val, name, t) elseif pandoc.utils.type(val) == "Blocks" then return pandoc.utils.blocks_to_inlines(val) elseif pandoc.utils.type(val) == "List" and #val == 1 then - return processValue(val[1]) + return processValue(val[1], name, t) else warn("Unsupported type '" .. pandoc.utils.type(val) .. "' for key " .. name .. " in a " .. t .. " shortcode.") return { pandoc.Strong(pandoc.Inlines { pandoc.Str("?invalid " .. t .. " type:" .. name) } ) } diff --git a/tests/docs/smoke-all/shortcodes/meta-bad-data.qmd b/tests/docs/smoke-all/shortcodes/meta-bad-data.qmd new file mode 100644 index 00000000000..8cb4ce523da --- /dev/null +++ b/tests/docs/smoke-all/shortcodes/meta-bad-data.qmd @@ -0,0 +1,5 @@ +--- +bad-meta: [[1,2]] +--- + +{{< meta bad-meta >}}