This commit is contained in:
Felix Ableitner 2024-03-01 10:48:30 +01:00
parent fd990f410d
commit 2d98d9466a

View file

@ -60,7 +60,9 @@ pub async fn fetch_object_http<T: Clone, Kind: DeserializeOwned>(
let res = fetch_object_http_with_accept(url, data, &CONTENT_TYPE).await?;
// Ensure correct content-type to prevent vulnerabilities.
if res.content_type != Some(CONTENT_TYPE) && res.content_type != Some(ALT_CONTENT_TYPE) {
if res.content_type.as_ref() != Some(&CONTENT_TYPE)
&& res.content_type.as_ref() != Some(&ALT_CONTENT_TYPE)
{
return Err(Error::FetchInvalidContentType(res.url));
}