Skip to content

fix: handle non-ASCII characters in WSL file paths (#1794) - #1804

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:fix/wsl-non-ascii-uri
Oct 31, 2026
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:fix/wsl-non-ascii-uri

Conversation

@angelozerr

Copy link
Copy Markdown
Contributor

Fixes #1794

Use the multi-argument URI constructor to properly percent-encode non-ASCII characters (e.g. Cyrillic) in WSL paths instead of URI.create() which requires pre-encoded input.

…1794)

Fixes redhat-developer#1794

Use the multi-argument URI constructor to properly percent-encode
non-ASCII characters (e.g. Cyrillic) in WSL paths instead of
URI.create() which requires pre-encoded input.

Signed-off-by: azerr <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1642760-45cd-4ea7-9468-b9e8b1b00187
Commits

Reviewing files that changed from the base of the PR and between 00ad293 and 91a1230.

Files selected for processing: 2
  • src/main/java/com/redhat/devtools/lsp4ij/internal/uri/WslUriConverter.java
  • src/test/java/com/redhat/devtools/lsp4ij/internal/uri/WslUriConverterTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • WSL file paths containing non-ASCII characters are now correctly encoded in their URIs.
  • Tests
    • Added coverage for WSL paths, including paths with non-ASCII characters, and for non-WSL paths.

WslUriConverter.toUri now uses the multi-argument URI constructor to encode non-ASCII characters in WSL file paths. If construction throws URISyntaxException, it logs a warning and returns null. Tests cover WSL path variants and a non-WSL path.

Changes: WSL URI conversion

Layer / File(s) Summary
WSL URI construction and tests
src/main/java/com/redhat/devtools/lsp4ij/internal/uri/WslUriConverter.java, src/test/java/com/redhat/devtools/lsp4ij/internal/uri/WslUriConverterTest.java
toUri uses the multi-argument URI constructor and logs a warning if construction throws URISyntaxException. Tests cover localhost and wsl$ paths, a path with Cyrillic characters, and a non-WSL path.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 91a12

The change handles WSL paths containing spaces without the previous URI-construction exception. No actionable merge-blocking issue remains; merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the fix for non-ASCII characters in WSL file paths.
Description check Passed The description directly explains the URI constructor change and its purpose for percent-encoding non-ASCII WSL paths.
Linked Issues check Passed Issue [#1794] requires WSL paths with non-ASCII characters to convert without IllegalArgumentException. WslUriConverter.toUri now uses new URI("file", authority, uriPath, null, null), which perc…
Out of Scope Changes check Passed The pull request changes only WSL URI construction and adds focused tests for WSL paths, non-ASCII characters, and a non-WSL path. These changes directly support issue [#1794]. No unrelated change is …
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue [#1794] requires WSL paths with non-ASCII characters to convert without IllegalArgumentException. WslUriConverter.toUri now uses new URI("file", authority, uriPath, null, null), which percent-encodes non-ASCII path characters. The added toUri_nonAsciiCharacters test covers the reported Cyrillic path and checks the URI components. Existing WSL authority cases also remain covered.

Full details: Out of Scope Changes check

Explanation

The pull request changes only WSL URI construction and adds focused tests for WSL paths, non-ASCII characters, and a non-WSL path. These changes directly support issue [#1794]. No unrelated change is present in the reviewed diff.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.80%. Comparing base (beb3c80) to head (91a1230).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../devtools/lsp4ij/internal/uri/WslUriConverter.java 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1804      +/-   ##
==========================================
+ Coverage   36.72%   36.80%   +0.08%     
==========================================
  Files         783      783              
  Lines       29921    29923       +2     
  Branches     4534     5987    +1453     
==========================================
+ Hits        10987    11014      +27     
+ Misses      17020    16993      -27     
- Partials     1914     1916       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@angelozerr
angelozerr merged commit c77e391 into redhat-developer:main Oct 31, 2026
8 of 9 checks passed
@lagergren lagergren added this to the 0.30.0 milestone Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Illegal character exception in WSL2

2 participants