Skip to content

resolvePath does not resolve home-relative paths #1669

Description

@MUFFANUJ

Description

/api/resolvePath does not resolve home-relative paths that start with ~. A request for ~/my-preferred-dir/foo.py returns an empty resolved list even when the expanded path points to an existing file inside the server root_dir. ref: jupyterlab/jupyterlab#18875 (comment)

Reproduce

Start Jupyter Server with root_dir set to the user home directory and create ~/my-preferred-dir/foo.py. Then request /api/resolvePath?path=~%2Fmy-preferred-dir%2Ffoo.py. The response is {"resolved": []}, while requesting /api/resolvePath?path=my-preferred-dir%2Ffoo.py resolves the same file.

Expected behavior

/api/resolvePath should expand ~ before resolving the path and return the API path when the expanded file is inside root_dir, for example {"scope": "server", "path": "my-preferred-dir/foo.py"}.

Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions