-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
URI.allLocations leads to endless loop if URI has own schema #6377
Labels
bug
bugs found in the application
Comments
corneliusludmann
added a commit
to corneliusludmann/theia
that referenced
this issue
Oct 12, 2019
1 task
corneliusludmann
added a commit
to corneliusludmann/theia
that referenced
this issue
Oct 12, 2019
Fixes eclipse-theia#6377 Signed-off-by: Cornelius A. Ludmann <[email protected]>
Added PR #6378 that implements the |
1 task
corneliusludmann
added a commit
to corneliusludmann/theia
that referenced
this issue
Oct 14, 2019
…ith no parent - Adds `Path#hasDir` - Adds `location.path.hasDir` check in while loop of `URI#allLocations` - Adds some tests Fixes eclipse-theia#6377 Signed-off-by: Cornelius A. Ludmann <[email protected]>
akosyakov
pushed a commit
that referenced
this issue
Oct 16, 2019
- Adds `Path#hasDir` - Adds `location.path.hasDir` check in while loop of `URI#allLocations` - Adds some tests Fixes #6377 Signed-off-by: Cornelius A. Ludmann <[email protected]>
akosyakov
pushed a commit
to akosyakov/theia
that referenced
this issue
Feb 24, 2020
…ith no parent - Adds `Path#hasDir` - Adds `location.path.hasDir` check in while loop of `URI#allLocations` - Adds some tests Fixes eclipse-theia#6377 Signed-off-by: Cornelius A. Ludmann <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When you create an URI object with an individual scheme (not
file:
), calling.allLocations
leads to an endless loop. (Creating an URI withnew URI('foo.txt')
assumes an absolute path/foo.txt
which prevents the problem described below.) An URI with own scheme is used inuser-preferences-provider.ts
, for example.Reproduction Steps
Execute the following code:
will results in an endless loop at this code position: https://github.com/eclipse-theia/theia/blob/master/packages/core/src/common/uri.ts#L54
The reason is that
location
is equal tolocation.parent
andlocation.path.isRoot === false
.In my opinion, the root of this problems lies in
Path.dir
which returnsthis
when there is no path separator (see https://github.com/eclipse-theia/theia/blob/master/packages/core/src/common/path.ts#L124). I think, it would be more intuitive ifundefined
or so will returned in this case. Or we need something likehasParent
to distinguish this situation because theisRoot
check is not sufficient here.To fix this with as little potential side effects as possible, I suggest changing the while condition as follows:The text was updated successfully, but these errors were encountered: