removed is_file check from path extraction (#1299)

This commit is contained in:
epi
2026-02-08 09:36:53 -05:00
committed by GitHub
parent 143d5710fc
commit b4ceaef08d
2 changed files with 1 additions and 23 deletions
+1 -3
View File
@@ -233,9 +233,7 @@ impl<'a> Extractor<'a> {
}
// request and report assumed file
if (resp.is_file() || !resp.is_directory())
&& !c_handles.config.force_recursion
{
if !resp.is_directory() && !c_handles.config.force_recursion {
log::debug!("Extracted File: {resp}");
c_scanned_urls.add_file_scan(
-20
View File
@@ -192,26 +192,6 @@ impl FeroxResponse {
self.text.shrink_to_fit(); // allocated capacity shrinks to reflect the new size
}
/// Make a reasonable guess at whether the response is a file or not
///
/// Examines the last part of a path to determine if it has an obvious extension
/// i.e. http://localhost/some/path/stuff.js where stuff.js indicates a file
///
/// Additionally, inspects query parameters, as they're also often indicative of a file
pub fn is_file(&self) -> bool {
let has_extension = if let Some(mut path) = self.url.path_segments() {
if let Some(last) = path.next_back() {
last.contains('.') // last segment has some sort of extension, probably
} else {
false
}
} else {
false
};
self.url.query_pairs().count() > 0 || has_extension
}
/// Returns line count of the response text.
pub fn line_count(&self) -> usize {
self.line_count