Skip to content

Commit

Permalink
Improve file:// url parsing (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
oscar6echo authored May 14, 2024
1 parent 86339ec commit 19ff135
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utoipa-swagger-ui/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use reqwest::Url;
use std::{
env,
error::Error,
Expand Down Expand Up @@ -37,7 +38,7 @@ fn main() {
println!("start download to : {:?}", zip_path);
download_file(&url, zip_path.clone()).unwrap();
} else if url.starts_with("file://") {
let file_path = url.replace("file://", "");
let file_path = Url::parse(&url).unwrap().to_file_path().unwrap();
println!("start copy to : {:?}", zip_path);
fs::copy(file_path, zip_path.clone()).unwrap();
} else {
Expand Down

0 comments on commit 19ff135

Please sign in to comment.