Fix relative URLs in manifests not being handled

This commit is contained in:
CenTdemeern1 2025-02-02 23:06:24 +01:00
parent ac481ec06a
commit 108eb427b8

View file

@ -20,12 +20,14 @@ struct ManifestIcon {
/// Scans a Web App Manifest for icons. /// Scans a Web App Manifest for icons.
pub async fn scan_manifest(client: &Client, url: impl IntoUrl) -> Result<Vec<Icon>, Error> { pub async fn scan_manifest(client: &Client, url: impl IntoUrl) -> Result<Vec<Icon>, Error> {
let manifest: Manifest = client.get(url).send().await?.json().await?; let url = url.into_url()?;
let manifest: Manifest = client.get(url.clone()).send().await?.json().await?;
Ok(join_all( Ok(join_all(
manifest manifest
.icons .icons
.into_iter() .into_iter()
.map(|i| Icon::from_url(client, i.src, IconKind::LinkedInManifest)), .filter_map(|i| url.join(&i.src).ok())
.map(|u| Icon::from_url(client, u, IconKind::LinkedInManifest)),
) )
.await .await
.into_iter() .into_iter()