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

Redirect paths from the notebooks route to the tree route if they are directories #7446

Merged

Conversation

andyscho
Copy link
Contributor

Resolves #7445 by checking if notebooks/<path> paths are directories before attempting to load them as notebooks.

Copy link
Contributor

Binder 👈 Launch a Binder on branch andyscho/notebook/notebooks-route-directory-redirect-to-tree

@andyscho andyscho force-pushed the notebooks-route-directory-redirect-to-tree branch from 22aa6d8 to 3820e3e Compare August 26, 2024 07:28
@jtpio
Copy link
Member

jtpio commented Sep 6, 2024

Nice, thanks @andyscho for looking into this!

@jtpio jtpio added this to the 7.3.0 milestone Sep 6, 2024
Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


NotebookHandler.redirect = redirect
await jp_fetch("notebooks", "jlab_test_notebooks")
assert redirected_url == "/a%40b/tree/jlab_test_notebooks"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this test!

In addition to this test, maybe it could be interesting to add a UI test to mimic real user interactions: https://github.com/jupyter/notebook/tree/main/ui-tests

But we can track that in a separate issue 👍

@jtpio jtpio merged commit 59f8c30 into jupyter:main Sep 9, 2024
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

notebooks/<path> directory urls show error instead of redirecting to tree/<path> urls
3 participants