From e6ef3a1cbe497585b7f49cc6da1e24cc7a613668 Mon Sep 17 00:00:00 2001 From: monosans Date: Tue, 5 Aug 2025 07:39:21 +0300 Subject: [PATCH] fix: streamline file reading logic in scrape_one function --- src/scraper.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/scraper.rs b/src/scraper.rs index 64c52db..402b0e4 100644 --- a/src/scraper.rs +++ b/src/scraper.rs @@ -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")]