From 29c5f2d3948551d4f890e7f4b19f330704755800 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 5 Nov 2021 14:06:31 -0700 Subject: [PATCH] Show an error when opening an old unsupported jupyter format Fix #136544 --- extensions/ipynb/src/notebookSerializer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/ipynb/src/notebookSerializer.ts b/extensions/ipynb/src/notebookSerializer.ts index 8a1fd18fcac..78e4bc31621 100644 --- a/extensions/ipynb/src/notebookSerializer.ts +++ b/extensions/ipynb/src/notebookSerializer.ts @@ -40,6 +40,10 @@ export class NotebookSerializer implements vscode.NotebookSerializer { } } + if (json.nbformat && json.nbformat < 5) { + throw new Error('Only Jupyter notebooks version 4+ are supported'); + } + // Then compute indent from the contents (only use first 1K characters as a perf optimization) const indentAmount = contents ? detectIndent(contents.substring(0, 1_000)).indent : ' ';