From: Dessalines Date: Mon, 11 May 2020 18:01:10 +0000 (-0400) Subject: Removing 2nd match. X-Git-Url: http://these/git/%7B%24%7B%60data:application/static/%7B%7D/inbox?a=commitdiff_plain;h=f7c947888f9faa5209076151189e6537d70fa139;p=lemmy.git Removing 2nd match. --- diff --git a/server/src/lib.rs b/server/src/lib.rs index 5566ca69..3aa192b7 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -197,47 +197,46 @@ fn fetch_iframely_and_pictshare_data( Option, Option, ) { - // Fetch iframely data - let (iframely_title, iframely_description, iframely_thumbnail_url, iframely_html) = match &url { - Some(url) => match fetch_iframely(url) { - Ok(res) => (res.title, res.description, res.thumbnail_url, res.html), - Err(e) => { - error!("iframely err: {}", e); - (None, None, None, None) - } - }, - None => (None, None, None, None), - }; - - // Fetch pictshare thumbnail - let pictshare_thumbnail = match iframely_thumbnail_url { - Some(iframely_thumbnail_url) => match fetch_pictshare(&iframely_thumbnail_url) { - Ok(res) => Some(res.url), - Err(e) => { - error!("pictshare err: {}", e); - None - } - }, - - None => match url { - Some(url) => match fetch_pictshare(&url) { + match &url { + Some(url) => { + // Fetch iframely data + let (iframely_title, iframely_description, iframely_thumbnail_url, iframely_html) = + match fetch_iframely(url) { + Ok(res) => (res.title, res.description, res.thumbnail_url, res.html), + Err(e) => { + error!("iframely err: {}", e); + (None, None, None, None) + } + }; + + // Fetch pictshare thumbnail + let pictshare_thumbnail = match iframely_thumbnail_url { + Some(iframely_thumbnail_url) => match fetch_pictshare(&iframely_thumbnail_url) { + Ok(res) => Some(res.url), + Err(e) => { + error!("pictshare err: {}", e); + None + } + }, // Try to generate a small thumbnail if iframely is not supported - Ok(res) => Some(res.url), - Err(e) => { - error!("pictshare err: {}", e); - None - } - }, - None => None, - }, - }; - - ( - iframely_title, - iframely_description, - iframely_html, - pictshare_thumbnail, - ) + None => match fetch_pictshare(&url) { + Ok(res) => Some(res.url), + Err(e) => { + error!("pictshare err: {}", e); + None + } + }, + }; + + ( + iframely_title, + iframely_description, + iframely_html, + pictshare_thumbnail, + ) + } + None => (None, None, None, None), + } } pub fn markdown_to_html(text: &str) -> String {