Repository navigation
fix: find a WSL file whose path has a space from its URI - #2355
Conversation
UriConverterManager decodes a URI that contains '%' before it asks the converters, and WslUriConverter parsed the decoded string with new URI, which rejects a space. It now splits the URI by hand, so the files below a WSL path with a space are found. Fixes redhat-developer#2354 Signed-off-by: Daniel Biehl <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the WSL URI conversion change.
No open issues 🎉
What changed in this PR
Fixes WSL file lookup for paths containing spaces (#2354), allowing diagnostics to resolve files from URIs already decoded by UriConverterManager.
Changes:
- Replaces strict URI parsing with a helper that splits decoded WSL URIs into UNC paths.
- Adds tests for both WSL host formats, spaces, non-ASCII paths, and non-WSL URIs.
| File | Description |
|---|---|
| src/test/java/com/redhat/devtools/lsp4ij/internal/uri/WslUriConverterTest.java | Adds UNC conversion tests, including decoded URI regressions. |
| src/main/java/com/redhat/devtools/lsp4ij/internal/uri/WslUriConverter.java | Adds toUncPath and uses it for Windows file lookup. |
Review effort: Balanced
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2355 +/- ##
==========================================
+ Coverage 58.63% 59.63% +0.99%
==========================================
Files 849 857 +8
Lines 36719 37282 +563
Branches 7609 5864 -1745
==========================================
+ Hits 21530 22232 +702
+ Misses 12187 11991 -196
- Partials 3002 3059 +57 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Java reads `\u` as the start of a Unicode escape also in comments, so the examples wrote `home\\user`. With `home\dev` they read as plain paths. Signed-off-by: Daniel Biehl <[email protected]>
…test has listed the temp directory Each test built its JAR in a new folder of the temp directory and looked it up without a refresh. Once another test of the same JVM had listed the temp directory, the VFS didn't look for the new folder on disk, and the first assertTemplates failed, as on IntelliJ 2025.3 in a CI run of #2355. The first build of a test's JAR is now looked up with a refresh, as the IDE knows the JAR from which it read the templates at its previous start. Fixes #2360
lagergren
left a comment
There was a problem hiding this comment.
One small follow-up to the rename: the two conversion examples still have home/user on their URI side, so they now convert home/user into home\dev and back. The suggestions below make both sides home/dev.
Signed-off-by: Daniel Biehl <[email protected]>
Fixes #2354.
In a project inside WSL whose path contains a space, LSP4IJ doesn't find the file of a URI it built itself, so the diagnostics for these files don't appear.
UriConverterManager.findResourceForURL-decodes every URI that contains%before it asks the converters, andWslUriConverter.findResourceForparsed the decoded string withnew URI(uri), which rejects the space.WslUriConverternow splits the URI into authority and path by hand, in the newtoUncPath, which works for the decoded string. The decoding in the manager stays as it is.The new tests in
WslUriConverterTestconvert WSL URIs to UNC paths, among them the URIs thattoUricreates for a path with a space and for the non-ASCII path of #1794, decoded as the manager does. Before the change,new URIthrewURISyntaxExceptionfor such a decoded string, as in the issue. Locally, on Linux,./gradlew checkpasses (2,658 tests).