diff --git a/src-tauri/src/commands/feed.rs b/src-tauri/src/commands/feed.rs index 6abe4d0..aba8ec2 100644 --- a/src-tauri/src/commands/feed.rs +++ b/src-tauri/src/commands/feed.rs @@ -45,9 +45,9 @@ pub async fn add_feed(url: &str) -> Result { Feed::add(title, &feed.url, &feed.feed_url, icon) } None => { - return Err(Error::MissingField( + Err(Error::MissingField( "No RSS/Atom/JSON feed found at this URL".into(), - )); + )) } } } @@ -60,7 +60,7 @@ pub async fn get_feeds() -> Result, Error> { #[tauri::command] pub async fn remove_feed(website_url: &str) -> Result { - Ok(Feed::remove(website_url)?) + Feed::remove(website_url) } // ======================================================= @@ -75,7 +75,7 @@ pub async fn get_feed_item(website_url: String) -> Result, Error> .await?; FeedItem::from_feed(&xml) } else { - return Err(Error::MissingField("no feed found in the settings.".into())); + Err(Error::MissingField("no feed found in the settings.".into())) } } @@ -91,6 +91,6 @@ pub async fn get_entry(website_url: String, target_url: String) -> Result String { format!("https:{}", href) } else if href.starts_with('/') { // رابط مطلق نسبي - let base = if base.ends_with('/') { - &base[..base.len() - 1] - } else { - base - }; + let base = base.strip_suffix('/').unwrap_or(base); + format!("{}{}", base, href) } else { // رابط نسبي