Skip to content

Commit 5bbcc1a

Browse files
committed
don't touch arrays either
1 parent 1f6c0b9 commit 5bbcc1a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/core/jupyter/jupyter.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,14 +923,17 @@ export function jupyterCellWithOptions(
923923
}
924924
};
925925

926-
const validMetadata: Record<string, string | number | boolean | null> = {};
926+
const validMetadata: Record<
927+
string,
928+
string | number | boolean | null | Array<unknown>
929+
> = {};
927930
for (const key of Object.keys(cell.metadata)) {
928931
const value = cell.metadata[key];
929932
let jsonEncodedKeyIndex = 0;
930933
if (value !== undefined) {
931934
if (!value && typeof value === "object") {
932935
validMetadata[key] = null;
933-
} else if (value && typeof value === "object") {
936+
} else if (value && typeof value === "object" && !Array.isArray(value)) {
934937
// https://github.com/quarto-dev/quarto-cli/issues/9089
935938
// we need to json-encode this and signal the encoding in the key
936939
// we can't use the key as is since it may contain invalid characters
@@ -944,7 +947,7 @@ export function jupyterCellWithOptions(
944947
] = JSON.stringify({ key, value });
945948
} else if (
946949
typeof value === "string" || typeof value === "number" ||
947-
typeof value === "boolean"
950+
typeof value === "boolean" || Array.isArray(value)
948951
) {
949952
validMetadata[key] = value;
950953
} else {

0 commit comments

Comments
 (0)