Removing 2nd match.

This commit is contained in:
Dessalines 2020-05-11 14:01:10 -04:00
parent 2719daffb0
commit f7c947888f

View file

@ -197,47 +197,46 @@ fn fetch_iframely_and_pictshare_data(
Option<String>, Option<String>,
Option<String>, Option<String>,
) { ) {
// Fetch iframely data match &url {
let (iframely_title, iframely_description, iframely_thumbnail_url, iframely_html) = match &url { Some(url) => {
Some(url) => match fetch_iframely(url) { // Fetch iframely data
Ok(res) => (res.title, res.description, res.thumbnail_url, res.html), let (iframely_title, iframely_description, iframely_thumbnail_url, iframely_html) =
Err(e) => { match fetch_iframely(url) {
error!("iframely err: {}", e); Ok(res) => (res.title, res.description, res.thumbnail_url, res.html),
(None, None, None, None) Err(e) => {
} error!("iframely err: {}", e);
}, (None, None, None, None)
None => (None, None, None, None), }
}; };
// Fetch pictshare thumbnail // Fetch pictshare thumbnail
let pictshare_thumbnail = match iframely_thumbnail_url { let pictshare_thumbnail = match iframely_thumbnail_url {
Some(iframely_thumbnail_url) => match fetch_pictshare(&iframely_thumbnail_url) { Some(iframely_thumbnail_url) => match fetch_pictshare(&iframely_thumbnail_url) {
Ok(res) => Some(res.url), Ok(res) => Some(res.url),
Err(e) => { Err(e) => {
error!("pictshare err: {}", e); error!("pictshare err: {}", e);
None None
} }
}, },
None => match url {
Some(url) => match fetch_pictshare(&url) {
// Try to generate a small thumbnail if iframely is not supported // Try to generate a small thumbnail if iframely is not supported
Ok(res) => Some(res.url), None => match fetch_pictshare(&url) {
Err(e) => { Ok(res) => Some(res.url),
error!("pictshare err: {}", e); Err(e) => {
None error!("pictshare err: {}", e);
} None
}, }
None => None, },
}, };
};
( (
iframely_title, iframely_title,
iframely_description, iframely_description,
iframely_html, iframely_html,
pictshare_thumbnail, pictshare_thumbnail,
) )
}
None => (None, None, None, None),
}
} }
pub fn markdown_to_html(text: &str) -> String { pub fn markdown_to_html(text: &str) -> String {