Skip to content

Server insists preferred_path be a path on local disk #961

Closed
@vidartf

Description

@vidartf

Description

The current validator for ServerApp.preferred_dir insists on the value being a path on the file system, even if the contents manager is not file-based. If the value is not configured, it will use the root_dir value, which will cause clients like JupyterLab to query the contents manager for the FS based path, which will always pop up an error on session startup "Directory not found". I will open a separate issue on the JupyterLab repo for the fact that this happens even if you have a /tree/... path in the URL. Since I cannot even specify "/" for the preferred dir since it is not a subdir of root_dir, this basically breaks non-FS based contents managers from version 1.10.0 (in the sense that a pop-up at every page load of JupyterLab is breaking).

Reproduce

Configure a non-FS based value for preferred_dir:

> jupyter server --preferred-dir="/not-a/file/path"
[C 2022-09-02 17:47:08.623 ServerApp] Bad config encountered during initialization: No such preferred dir: ''/not-a/file/path''

Expected behavior

You can specify any path for which the configured contents manager returns true for dir_exists.

Context

preferred_path was introduced in #549, with one of the conditions in the description being "is required to be an existing directory residing at or within root_dir". This is a fine condition if the contents manager is file-based, but makes no sense for other contents managers.

Workarounds

Override the ServerApp from jupyter-server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions