* Fix doctype check issue for metadata fetching. Fixes #4468 * Change warn to info.
This commit is contained in:
parent
f3d48f2c2c
commit
e01ea32928
1 changed files with 4 additions and 2 deletions
|
@ -53,7 +53,9 @@ pub async fn fetch_link_metadata(
|
||||||
// https://github.com/LemmyNet/lemmy/issues/1964
|
// https://github.com/LemmyNet/lemmy/issues/1964
|
||||||
let html_bytes = response.bytes().await.map_err(LemmyError::from)?.to_vec();
|
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(
|
let thumbnail = extract_thumbnail_from_opengraph_data(
|
||||||
url,
|
url,
|
||||||
&opengraph_data,
|
&opengraph_data,
|
||||||
|
@ -96,7 +98,7 @@ fn extract_opengraph_data(html_bytes: &[u8], url: &Url) -> Result<OpenGraphData,
|
||||||
.ok_or(LemmyErrorType::NoLinesInHtml)?
|
.ok_or(LemmyErrorType::NoLinesInHtml)?
|
||||||
.to_lowercase();
|
.to_lowercase();
|
||||||
|
|
||||||
if !first_line.starts_with("<!doctype html>") {
|
if !first_line.starts_with("<!doctype html") {
|
||||||
Err(LemmyErrorType::SiteMetadataPageIsNotDoctypeHtml)?
|
Err(LemmyErrorType::SiteMetadataPageIsNotDoctypeHtml)?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue