File download in JupyterLab does not work if jupyter-fs is installed
jeflem opened this issue · 1 comments
Describe the bug
If jupyter-fs is installed, in Lab 'File' > 'Download' or right-click on file in standard Lab file browser > 'Download' do not work (nothing happens). Right-click in standard file browser > 'Copy Download Link', then pasting link into browser address bar yields '503 service unavailble'. The whole raw file request mechanism via /files API endpoint stops working.
To Reproduce
Steps to reproduce the behavior:
- Install JupyterLab and jupyter-fs
- Right-click some file in Lab's file browser. Then 'Download'.
Expected behavior
Webbrowser starts download (asks where to save the file or saves it to standard location).
Desktop (please complete the following information):
- OS: Debian 12
- jupyter-fs 0.3.1 with minor bugfix in is_hidden (main already has this fix)
- JupyterLab 4.0.4
Log output
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: [E 2023-10-06 20:45:33.958 ServerApp] Uncaught exception
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: Traceback (most recent call last):
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/http1connection.py", line 276, in _read_m>
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: delegate.finish()
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/httpserver.py", line 399, in finish
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: self.delegate.finish()
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/routing.py", line 268, in finish
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: self.delegate.finish()
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/web.py", line 2395, in finish
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: self.execute()
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/web.py", line 2417, in execute
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: self.handler = self.handler_class(
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: ^^^^^^^^^^^^^^^^^^^
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/web.py", line 238, in __init__
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: self.initialize(**kwargs) # type: ignore
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: ^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 06 20:45:33 2ba3e1fbebad jupyterhub-singleuser[98500]: TypeError: StaticFileHandler.initialize() missing 1 required positional argument: 'path'
Oct 06 20:45:33 2ba3e1fbebad jupyterhub[93466]: 20:45:33.965 [ConfigProxy] error: 503 GET /whz-mathe-test/user/u21302575108/files/test.ipynb socket hang up
Oct 06 20:45:33 2ba3e1fbebad jupyterhub[93460]: [D 2023-10-06 20:45:33.968 JupyterHub pages:584] No template for 503
Oct 06 20:45:33 2ba3e1fbebad jupyterhub[93460]: [I 2023-10-06 20:45:33.970 JupyterHub log:191] 200 GET /whz-mathe-test/hub/error/503?url=%2Fwhz-mathe-test%2Fuser%2Fu21302>
Solution
In metamanager.py
the MetaManager
class has to set files_handler_params = {'path': self.root_dir}
member variable, which defaults to {}
making Jupyter Server's FilesHandler
fail (cf. Jupyter Server's standard contents manager FileContentsManager
).
Have to correct my initial solution: add
@property
def files_handler_params(self):
return {'path': self.root_dir}
to MetaManager
class in metamanger.py
. Else loading the jupyter-fs extension will fail (but initial solution works if code is modified after extension has been loaded!?).