fix(jupyter): adopted to support more formats. Fixes: RCCE-38

This commit is contained in:
Serhii Ilin 2024-01-29 12:23:16 +02:00
parent 38c00aa2be
commit 79aeb82ee8

View file

@ -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: