diff --git a/src/core.rs b/src/core.rs index 39988d43..d42790de 100644 --- a/src/core.rs +++ b/src/core.rs @@ -449,6 +449,7 @@ pub fn detect_media_type_by_file_name(filename: &str) -> String { "tif" | "tiff" => "image/tiff", "txt" => "text/plain", "wav" => "audio/wav", + "webmanifest" => "application/manifest+json", "webp" => "image/webp", "woff" => "font/woff", "woff2" => "font/woff2", diff --git a/src/html.rs b/src/html.rs index d2c64496..1573557e 100644 --- a/src/html.rs +++ b/src/html.rs @@ -31,6 +31,7 @@ pub enum LinkType { Favicon, Preload, Stylesheet, + Manifest, } pub struct SrcSetItem<'a> { @@ -369,6 +370,8 @@ pub fn parse_link_type(link_attr_rel_value: &str) -> Vec { types.push(LinkType::Favicon); } else if link_attr_rel_type.eq_ignore_ascii_case("apple-touch-icon") { types.push(LinkType::AppleTouchIcon); + } else if link_attr_rel_type.eq_ignore_ascii_case("manifest") { + types.push(LinkType::Manifest); } } @@ -848,6 +851,19 @@ pub fn walk(session: &mut Session, document_url: &Url, node: &Handle) { ); } } + } else if link_node_types.contains(&LinkType::Manifest) { + // Resolve LINK's href attribute + if let Some(link_attr_href_value) = get_node_attr(node, "href") { + if !link_attr_href_value.is_empty() { + retrieve_and_embed_asset( + session, + document_url, + node, + "href", + &link_attr_href_value, + ); + } + } } else if link_node_types.contains(&LinkType::Preload) || link_node_types.contains(&LinkType::DnsPrefetch) {