Removed faulty Windows-specific path check/conversion. Fixes #2076. (#2088)

This commit is contained in:
Orson Peters 2023-01-27 21:22:13 +01:00 committed by Vincent Prouillet
parent 60d8425470
commit 29cb3fca7a

View File

@ -149,19 +149,6 @@ impl TeraFn for GetUrl {
};
}
if cfg!(target_os = "windows") {
permalink = match url::Url::parse(&permalink) {
Ok(parsed) => parsed.into(),
Err(_) => {
return Err(format!(
"`get_url`: Could not parse link `{}` as a valid URL",
permalink
)
.into())
}
};
}
Ok(to_value(permalink).unwrap())
}
}
@ -645,27 +632,6 @@ title = "A title"
);
}
#[test]
fn can_resolve_asset_path_to_valid_url() {
let config = Config::parse(CONFIG_DATA).unwrap();
let dir = create_temp_dir();
let static_fn =
GetUrl::new(dir.path().to_path_buf(), config, HashMap::new(), PathBuf::new());
let mut args = HashMap::new();
args.insert(
"path".to_string(),
to_value(dir.path().join("app.css").strip_prefix(std::env::temp_dir()).unwrap())
.unwrap(),
);
assert_eq!(
static_fn.call(&args).unwrap(),
format!(
"https://remplace-par-ton-url.fr/{}/app.css",
dir.path().file_stem().unwrap().to_string_lossy()
)
)
}
#[test]
fn error_when_file_not_found_for_hash() {
let dir = create_temp_dir();