diff --git a/CHANGES.md b/CHANGES.md index 34493b28..5749f081 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Rojo Change Log ## Current Master -* *No changes* +* Fixed server when using a file as a partition + * Previously, trailing slashes were put on the end of a partition even if the read request was an empty string. This broke file reading on Windows when a partition pointed to a file instead of a directory! ## 0.2.3 * Plugin only release diff --git a/src/vfs.rs b/src/vfs.rs index 7a709b14..44b9165f 100644 --- a/src/vfs.rs +++ b/src/vfs.rs @@ -62,7 +62,12 @@ impl Vfs { None => return None, }; - let full_path = { + // It's possible that the partition points to a file if `rest` is empty. + // Joining "" onto a path will put a trailing slash on, which causes + // file reads to fail. + let full_path = if rest.is_empty() { + partition.clone() + } else { let joined = rest.join("/"); let relative = Path::new(&joined);