From 79aeb82ee868efe3cecce85a1600cea6d517f4c8 Mon Sep 17 00:00:00 2001 From: Serhii Ilin Date: Mon, 29 Jan 2024 12:23:16 +0200 Subject: [PATCH] fix(jupyter): adopted to support more formats. Fixes: RCCE-38 --- rhodecode/lib/markup_renderer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rhodecode/lib/markup_renderer.py b/rhodecode/lib/markup_renderer.py index 182ed4ec..1016ee3c 100644 --- a/rhodecode/lib/markup_renderer.py +++ b/rhodecode/lib/markup_renderer.py @@ -449,7 +449,7 @@ class MarkupRenderer(object): cell.source = cls.sanitize_html(cell.source) return cell, resources - for cell_output in cell.outputs: + for cell_output in cell.get('outputs', []): if 'data' in cell_output: if 'application/javascript' in cell_output['data']: cell_output['data']['text/plain'] = sandbox_text @@ -553,7 +553,7 @@ class MarkupRenderer(object): else: try: body, _ = as_html(notebook) - except AttributeError: + except (AttributeError, nbformat.ValidationError): try: nbformat.validate(nbformat.reader.reads(source)) except nbformat.ValidationError as exc: