From c0b404074324c07f174dad709ffc42ae6c49d249 Mon Sep 17 00:00:00 2001 From: godylockz <81207744+godylockz@users.noreply.github.com> Date: Sat, 29 Jan 2022 09:20:44 -0500 Subject: [PATCH] Fix relative pathing --- src/extractor/container.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/extractor/container.rs b/src/extractor/container.rs index 1338c3a..d285187 100644 --- a/src/extractor/container.rs +++ b/src/extractor/container.rs @@ -191,9 +191,10 @@ impl<'a> Extractor<'a> { // this is the expected error that happens when we try to parse a url fragment // ex: Url::parse("/login") -> Err("relative URL without a base") // while this is technically an error, these are good results for us + let absolute_path = format!("{}{}", resp_url.path().to_string(), link.to_string()); if e.to_string().contains("relative URL without a base") { - if self.add_all_sub_paths(link, &mut links).is_err() { - log::warn!("could not add sub-paths from {} to {:?}", link, links); + if self.add_all_sub_paths(&absolute_path, &mut links).is_err() { + log::warn!("could not add sub-paths from {} to {:?}", absolute_path, links); } } else { // unexpected error has occurred @@ -498,9 +499,10 @@ impl<'a> Extractor<'a> { // this is the expected error that happens when we try to parse a url fragment // ex: Url::parse("/login") -> Err("relative URL without a base") // while this is technically an error, these are good results for us + let absolute_path = format!("{}{}", resp_url.path().to_string(), link.to_string()); if e.to_string().contains("relative URL without a base") { - if self.add_all_sub_paths(link, links).is_err() { - log::warn!("could not add sub-paths from {} to {:?}", link, links); + if self.add_all_sub_paths(&absolute_path, links).is_err() { + log::warn!("could not add sub-paths from {} to {:?}", absolute_path, links); } } else { // unexpected error has occurred