fix: streamline file reading logic in scrape_one function

This commit is contained in:
monosans
2025-08-05 07:39:21 +03:00
parent dc13044ca3
commit e6ef3a1cbe
+2 -11
View File
@@ -25,21 +25,12 @@ async fn scrape_one(
"http" | "https" => http::fetch_text(http_client, source).await,
_ => match u.to_file_path() {
Ok(path) => tokio::fs::read_to_string(path).await,
Err(()) => {
tokio::fs::read_to_string(
source.strip_prefix("file://").unwrap_or(source),
)
.await
}
Err(()) => tokio::fs::read_to_string(source).await,
}
.map_err(Into::into),
}
} else {
tokio::fs::read_to_string(
source.strip_prefix("file://").unwrap_or(source),
)
.await
.map_err(Into::into)
tokio::fs::read_to_string(source).await.map_err(Into::into)
};
#[cfg(feature = "tui")]