From e01ea32928aec99fde18a6bd141a77b0f7f5aeea Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 26 Feb 2024 10:24:09 -0500 Subject: [PATCH] Fix doctype check issue for metadata fetching. Fixes #4468 (#4472) * Fix doctype check issue for metadata fetching. Fixes #4468 * Change warn to info. --- crates/api_common/src/request.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index b9ab42f7c..1eab50bc5 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -53,7 +53,9 @@ pub async fn fetch_link_metadata( // https://github.com/LemmyNet/lemmy/issues/1964 let html_bytes = response.bytes().await.map_err(LemmyError::from)?.to_vec(); - let opengraph_data = extract_opengraph_data(&html_bytes, url).unwrap_or_default(); + let opengraph_data = extract_opengraph_data(&html_bytes, url) + .map_err(|e| info!("{e}")) + .unwrap_or_default(); let thumbnail = extract_thumbnail_from_opengraph_data( url, &opengraph_data, @@ -96,7 +98,7 @@ fn extract_opengraph_data(html_bytes: &[u8], url: &Url) -> Result") { + if !first_line.starts_with("