Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

/tree/<path> should redirect to /notebooks/<path> if <path> is a notebook file #153

Closed
Tracked by #2422
yuvipanda opened this issue Jun 4, 2021 · 1 comment · Fixed by #159
Closed
Tracked by #2422

/tree/<path> should redirect to /notebooks/<path> if <path> is a notebook file #153

yuvipanda opened this issue Jun 4, 2021 · 1 comment · Fixed by #159
Labels
enhancement New feature or request

Comments

@yuvipanda
Copy link
Contributor

Problem

When redirecting users to a particular file (from nbgitpuller), it is important to not need prior knowledge on wether the target is a file or a directory. In lab and classic notebook, we can send people to /tree/<path>, it redirects to /notebooks/<path> if it's a notebook or /tree/<path> if it's just a directory, based on what ContentsManager says.

retrolab doesn't do that - if you go to /tree/<path> but <path> is a notebook you get an error.

Proposed Solution

class RetroTreeHandler(RetroHandler):
currently handles redirects. We could either figure out a contentsmanager check here, or do that on the client side

@yuvipanda yuvipanda added the enhancement New feature or request label Jun 4, 2021
@jtpio
Copy link
Member

jtpio commented Jun 4, 2021

Thanks @yuvipanda.

Probably doing the redirect in that handle will be enough. RetroLab should then be able to handle URLs that look like /retro/notebooks/example.ipynb

@yuvipanda yuvipanda changed the title /tree/<path> should redirect to /notebooks/<path> if <path> is a notebook file /tree/<path> should redirect to /notebooks/<path> if <path> is a notebook file Jun 4, 2021
@yuvipanda yuvipanda changed the title /tree/<path> should redirect to /notebooks/<path> if <path> is a notebook file /tree/<path> should redirect to /notebooks/<path> if <path> is a notebook file Jun 4, 2021
yuvipanda added a commit to yuvipanda/retrolab that referenced this issue Jun 8, 2021
- Show directory listing if path is a directory
- Show notebook if path is a notebook
- Show editor if path is a file

Copied from https://github.com/jupyter/notebook/blob/6fe9755971dba3357054766806d56cb8c6c1bca7/notebook/tree/handlers.py#L39

Fixes jupyterlab#153
yuvipanda added a commit to yuvipanda/retrolab that referenced this issue Jun 8, 2021
- Show directory listing if path is a directory
- Show notebook if path is a notebook
- Return file contents if path is any other file

Copied from https://github.com/jupyter/notebook/blob/6fe9755971dba3357054766806d56cb8c6c1bca7/notebook/tree/handlers.py#L39

Fixes jupyterlab#153
@jtpio jtpio closed this as completed in #159 Jun 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants