From 1329dbe6f8dc27baac731e5745eecdeb04f29f91 Mon Sep 17 00:00:00 2001 From: Vincent Flyson Date: Mon, 26 Aug 2019 22:57:10 -0400 Subject: [PATCH] Ignore iframes with empty src --- Cargo.toml | 2 +- src/html.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3490512..5920a17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monolith" -version = "2.0.14" +version = "2.0.15" authors = [ "Sunshine ", "Mahdi Robatipoor ", diff --git a/src/html.rs b/src/html.rs index 8aadb1a..a76cf78 100644 --- a/src/html.rs +++ b/src/html.rs @@ -287,7 +287,14 @@ pub fn walk_and_embed_assets( "iframe" => { for attr in attrs_mut.iter_mut() { if &attr.name.local == "src" { - let src_full_url: String = resolve_url(&url, &attr.value.to_string()) + let value = attr.value.to_string(); + // Ignore iframes with empty source (they cause infinite loops) + if value == EMPTY_STRING.clone() { + continue; + } + + + let src_full_url: String = resolve_url(&url, &value) .unwrap_or(EMPTY_STRING.clone()); let iframe_data = retrieve_asset( &src_full_url,