Skip to content

Commit c451dee

Browse files
committed
Removed faulty Windows-specific path check/conversion. Fixes getzola#2076.
1 parent 67b4eb8 commit c451dee

File tree

1 file changed

+0
-34
lines changed
  • components/templates/src/global_fns

1 file changed

+0
-34
lines changed

components/templates/src/global_fns/files.rs

-34
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,6 @@ impl TeraFn for GetUrl {
149149
};
150150
}
151151

152-
if cfg!(target_os = "windows") {
153-
permalink = match url::Url::parse(&permalink) {
154-
Ok(parsed) => parsed.into(),
155-
Err(_) => {
156-
return Err(format!(
157-
"`get_url`: Could not parse link `{}` as a valid URL",
158-
permalink
159-
)
160-
.into())
161-
}
162-
};
163-
}
164-
165152
Ok(to_value(permalink).unwrap())
166153
}
167154
}
@@ -645,27 +632,6 @@ title = "A title"
645632
);
646633
}
647634

648-
#[test]
649-
fn can_resolve_asset_path_to_valid_url() {
650-
let config = Config::parse(CONFIG_DATA).unwrap();
651-
let dir = create_temp_dir();
652-
let static_fn =
653-
GetUrl::new(dir.path().to_path_buf(), config, HashMap::new(), PathBuf::new());
654-
let mut args = HashMap::new();
655-
args.insert(
656-
"path".to_string(),
657-
to_value(dir.path().join("app.css").strip_prefix(std::env::temp_dir()).unwrap())
658-
.unwrap(),
659-
);
660-
assert_eq!(
661-
static_fn.call(&args).unwrap(),
662-
format!(
663-
"https://remplace-par-ton-url.fr/{}/app.css",
664-
dir.path().file_stem().unwrap().to_string_lossy()
665-
)
666-
)
667-
}
668-
669635
#[test]
670636
fn error_when_file_not_found_for_hash() {
671637
let dir = create_temp_dir();

0 commit comments

Comments
 (0)