Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voila doesn't load static HTML files despite whitelisting #1071

Closed
tilusnet opened this issue Jan 23, 2022 · 0 comments · Fixed by #1073
Closed

Voila doesn't load static HTML files despite whitelisting #1071

tilusnet opened this issue Jan 23, 2022 · 0 comments · Fixed by #1073
Labels
bug Something isn't working

Comments

@tilusnet
Copy link

Following up the conversation in #1044 (comment):

Description

My Jupyter notebook loads ipywidgets some of them instantiating IFrame objects loading static html files.

Despite whitelisting html files in Voila (v0.3.0), the Voila server fails with a 500 error:

ERROR:tornado.application:Uncaught exception GET /voila/render/hello.html (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8866', method='GET', uri='/voila/render/hello.html', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/home/tilushq/opt/miniconda3/envs/jupyter/lib/python3.7/site-packages/tornado/web.py", line 1704, in _execute
    result = await result
  File "/home/tilushq/opt/miniconda3/envs/jupyter/lib/python3.7/site-packages/voila/handler.py", line 150, in get
    kernel_name=gen.notebook.metadata.kernelspec.name,
AttributeError: 'NoneType' object has no attribute 'metadata'
ERROR:tornado.access:500 GET /voila/render/hello.html (127.0.0.1) 18.03ms

Reproduce

All files are in working directory X:

  • voila.json
  • test.ipynb
  • hello.html
  1. Create a voila.json file with configuration:
{
    "VoilaConfiguration": {
        "file_whitelist": [
            ".*\\.(html|js)"
        ]
    }
}
  1. Create a test.ipynb with the minimal code:
hello_file = 'hello.html'
hello_body = '<body><h1>Hello World!</h1></body>'

with open(hello_file, 'w') as fw:
    _ = fw.write(hello_body)
    
from IPython.display import display, display_html, IFrame

my_html_widget = IFrame(
    src=hello_file,
    width=300,
    height=100
)

import ipywidgets as w

widget_output = w.Output()
with widget_output:
    display(my_html_widget)

widget_output
  1. Invoke Voila in directory X:
    voila .

  2. Open test.ipynb in the browser and let it run.

The rendering fails:

image

Expected behavior

image

Context

  • voila version 0.3.0
  • Operating System and version: Ubuntu 20.04
  • Browser and version: Chrome 97
  • JupyterLab version: 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant