Skip to content

Commit 2dacbb0

Browse files
fix path_str on windows
1 parent 7ef503d commit 2dacbb0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

crates/djls-server/src/workspace.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ fn uri_to_pathbuf(uri: &Uri) -> Option<PathBuf> {
2929

3030
// Decode the percent-encoded path string
3131
let decoded_path_cow = percent_decode_str(encoded_path_str).decode_utf8_lossy();
32-
33-
#[cfg(unix)]
3432
let path_str = decoded_path_cow.as_ref();
33+
3534
#[cfg(windows)]
36-
// Remove leading '/' for paths like /C:/...
37-
let path_str = path_str.strip_prefix('/').unwrap_or(path_str);
35+
let path_str = {
36+
// Remove leading '/' for paths like /C:/...
37+
path_str.strip_prefix('/').unwrap_or(path_str)
38+
};
3839

3940
Some(PathBuf::from(path_str))
4041
}

0 commit comments

Comments
 (0)