-
Notifications
You must be signed in to change notification settings - Fork 343
Re-encode cwd if path does not exist #1214
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes the case where a folder name is cloned with url-encoded spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how this can fix the issue. Would you mind providing more explanation?
If I have a folder with the literal name:
jupyterlab-git does not recognize that any git repository exists in this folder (it shows the "You are not currently in a Git repository" page). This folder is encoded into the Jupyter URL as:
I believe the problem is that this URL is somehow getting decoded twice (or more) by the time it reaches the The desired value after exactly 1 decode:
The actual value (2 or more decodes happening):
Since the folder I'm unable to identify where/how exactly the URL is getting decoded twice, to fix the root cause. So for this PR I suggest checking if the path exists:
And if this path does not exist, try again but with the spaces encoded:
This fix will correctly identify that there is a git repository inside a folder literally named: Hope that clarifies the problem and the fix. |
Thanks for the additional explanation @ardislu So it means that with this PR if the repository is named |
And if you use the |
Correct.
Full end to end example:
Gives me a folder literally named |
Thanks a lot for the reply. My fear with the current fix is that it may escape unwanted space. For example if your repository is located at |
Fixes the case where a folder name is cloned with url-encoded spaces.
Closes #1211