Merge pull request #36 from Y2Z/no-images-no-icons
Ignore icons if told to avoid images
This commit is contained in:
commit
080ed50264
23
src/html.rs
23
src/html.rs
|
@ -137,15 +137,20 @@ pub fn walk_and_embed_assets(
|
||||||
NodeMatch::Icon => {
|
NodeMatch::Icon => {
|
||||||
for attr in attrs_mut.iter_mut() {
|
for attr in attrs_mut.iter_mut() {
|
||||||
if &attr.name.local == "href" {
|
if &attr.name.local == "href" {
|
||||||
let href_full_url = resolve_url(&url, &attr.value.to_string());
|
if opt_no_images {
|
||||||
let favicon_datauri = retrieve_asset(
|
attr.value.clear();
|
||||||
&href_full_url.unwrap(),
|
attr.value.push_slice(TRANSPARENT_PIXEL);
|
||||||
true,
|
} else {
|
||||||
"",
|
let href_full_url = resolve_url(&url, &attr.value.to_string());
|
||||||
opt_user_agent,
|
let favicon_datauri = retrieve_asset(
|
||||||
);
|
&href_full_url.unwrap(),
|
||||||
attr.value.clear();
|
true,
|
||||||
attr.value.push_slice(favicon_datauri.unwrap().as_str());
|
"",
|
||||||
|
opt_user_agent,
|
||||||
|
);
|
||||||
|
attr.value.clear();
|
||||||
|
attr.value.push_slice(favicon_datauri.unwrap().as_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue