Skip to content

Commit

Permalink
fix: format e2e not found paths correctly for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelmmiguel committed Oct 5, 2023
1 parent 5677688 commit b775e96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion crates/server/src/handlers/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ fn clean_up_path(uri: &str) -> PathBuf {

let valid_components: Vec<Component<'_>> = path
.components()
// Keep only normal components
// Keep only normal components. The relative components should be
// strip by actix, but we're double checking it in case of weird encodings
// that can be interpreted as parent paths. Note this is a path that will
// be appended later to the public folder.
.filter(|c| matches!(c, Component::Normal(_)))
.collect();

Expand Down
6 changes: 5 additions & 1 deletion tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ mod test {
});
let path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
let cargo_toml = path.join("Cargo.toml");
let cargo_toml_str = format!("http://localhost:8080{}", cargo_toml.to_string_lossy());
let cargo_toml_str = if cfg!(target_os = "windows") {
format!("http://localhost:8080/{}", cargo_toml.to_string_lossy())
} else {
format!("http://localhost:8080{}", cargo_toml.to_string_lossy())
};

// Test we're not exposing wrong files
let tests = [
Expand Down

0 comments on commit b775e96

Please sign in to comment.