Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,14 @@ public Path(String scheme, String authority, String path) {
private void initialize(String scheme, String authority, String path,
String fragment) {
try {
this.uri = new URI(scheme, authority, normalizePath(scheme, path), null, fragment)
// Normalize the path
String normalizedPath = normalizePath(scheme, path);

// Windows-specific fix: file URIs must start with "/"
if ("file".equalsIgnoreCase(scheme) && normalizedPath.matches("^[A-Za-z]:.*")) {
normalizedPath = "/" + normalizedPath.replace("\\", "/");
}
this.uri = new URI(scheme, authority, normalizedPath, null, fragment)
.normalize();
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
Expand Down