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

Use a relative path because a path cannot start with a drive letter #65

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

yjoer
Copy link
Contributor

@yjoer yjoer commented Oct 15, 2024

On Windows, an absolute path to files includes a drive letter, prohibited in L271 leading to the following stack trace. We should turn them into relative paths before calling is_hidden(...).

[W 2024-10-16 01:15:43.420 ServerApp] wrote error: 'D:\\Workspaces\\jpt-test\\.git is not a relative API path'
    Traceback (most recent call last):
      File "D:\Workspaces\jpt-test\.venv\Lib\site-packages\tornado\web.py", line 1790, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "D:\Workspaces\jpt-test\.venv\Lib\site-packages\jupyterlab_quickopen\handler.py", line 84, in get
        contents_by_path = await self.scan_disk(full_path, excludes)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\Workspaces\jpt-test\.venv\Lib\site-packages\jupyterlab_quickopen\handler.py", line 52, in scan_disk
+       if await self.should_hide(entry, excludes):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\Workspaces\jpt-test\.venv\Lib\site-packages\jupyterlab_quickopen\handler.py", line 43, in should_hide
+       await ensure_async(self.contents_manager.is_hidden(entry.path))
      File "D:\Workspaces\jpt-test\.venv\Lib\site-packages\jupyter_core\utils\__init__.py", line 198, in ensure_async
        result = await obj
                 ^^^^^^^^^
      File "D:\Workspaces\jpt-test\.venv\Lib\site-packages\jupyter_server\services\contents\filemanager.py", line 1090, in is_hidden
+       os_path = self._get_os_path(path=path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\Workspaces\jpt-test\.venv\Lib\site-packages\jupyter_server\services\contents\fileio.py", line 272, in _get_os_path
+       raise HTTPError(404, "%s is not a relative API path" % path)
    tornado.web.HTTPError: HTTP 404: Not Found (D:\Workspaces\jpt-test\.git is not a relative API path)

Copy link

Binder 👈 Launch a Binder on branch yjoer/jupyterlab-quickopen/fix-2

@jtpio jtpio added the bug Something isn't working label Oct 16, 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!

@jtpio jtpio merged commit 3c730b0 into jupyterlab-contrib:main Oct 16, 2024
6 of 7 checks passed
@yjoer yjoer deleted the fix-2 branch October 16, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants