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

Not consistent output of URLExt.join for Windows / Unix #10964

Open
pplonski opened this issue Aug 30, 2021 · 5 comments
Open

Not consistent output of URLExt.join for Windows / Unix #10964

pplonski opened this issue Aug 30, 2021 · 5 comments

Comments

@pplonski
Copy link

First of all, thank you! I'm using Jupyter almost every day. Thank you!

Description

I'm working on a desktop application that will be notebook with graphical interface to generate python code (it is an electron app). I'm using @jupyterlab/services TS packages in my app.

I have a problem with SessionManager. I got an error: Can only be used for notebook server request. I have this error only on Windows system, on Unix (Ubuntu/MacOS) it works OK.

I debug the error and it looks like there is a problem is with output from URLExt.join method. The example code and outputs below.

import { URLExt } from '@jupyterlab/coreutils';
console.log(URLExt.join('http://127.0.0.1/', 'api/sessions'); 

Output on Unix:

http://127.0.0.1/api/sessions

Output on Windows:

http://127.0.0.1\api\sessions

The @jupyterlab/coreutils version 5.1.8. I would expect to get the same output on Windows as in Unix.

Because of this difference the SessionManager cant run the poll to check sessions (it is getting error because the url of the request doesnt include the baseUrl).

Thank you!

@pplonski pplonski added the bug label Aug 30, 2021
@welcome
Copy link

welcome bot commented Aug 30, 2021

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@krassowski
Copy link
Member

Thank you for opening this! Could you please check with version lower than 5.1?

I suspect that this could be a regression in the url-parse dependency introduced when they were fixing a ReDOS, which got pulled in #10219. There were patch releases since then so maybe we can just upgrade, but it would be best to understand this better as an attempt to bump to a patch release in #10755 lead to some tests failing.

@pplonski
Copy link
Author

@krassowski thank you for help!

After downgrade of @jupyterlab/coreutils to 5.0.7 there is still wrong output on Windows. After downgrade to 4.3.1 the output on Windows and Unix is the same.

However, I can't make @jupyterlab/services classes to work. I still get error that url is wrong. I was trying to downgrade to 5.3.1 and then to 5.1.0 and now I have some installation problems, probably something related to my project ..., I will try to start with fresh install ...

@pplonski
Copy link
Author

pplonski commented Sep 1, 2021

@krassowski I can help with this issue. Is it a matter of fixing URLExt.join() to not change slashes direction?

@krassowski
Copy link
Member

Thank you, you are welcome to do so! I think that it would be a good idea to first bump url-parse in the dependencies to the latest version, and then try to fix the slashes, and add a test case for that. I am not 100% sure if this won't break someone else's use case, but I think that the slashes should not change between Unix and Windows when using URLExt.

Also, you may get more prompt feedback by opening a PR (some folks muted issues and only check once in a while due to the sheer number).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants