Skip to content

Commit

Permalink
Removed faulty Windows-specific path check/conversion. Fixes getzola#…
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp committed Jan 27, 2023
1 parent 67b4eb8 commit c451dee
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions components/templates/src/global_fns/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c451dee

Please sign in to comment.