mirror of
https://github.com/modrinth/code.git
synced 2026-09-05 06:19:11 +00:00
fix(app-lib): treat all errors as missing icon (#7333)
* fix(app-lib): treat all errors as missing icon * style(app-lib): cargo fmt
This commit is contained in:
@@ -200,9 +200,8 @@ pub(crate) async fn resolve_icon_path(
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(bytes) => bytes,
|
Ok(bytes) => bytes,
|
||||||
Err(error)
|
Err(error) if ignore_missing_remote_icon => {
|
||||||
if ignore_missing_remote_icon && is_not_found_error(&error) =>
|
tracing::warn!("Error while getting instance icon: {error}");
|
||||||
{
|
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
Err(error) => return Err(error),
|
Err(error) => return Err(error),
|
||||||
@@ -219,18 +218,6 @@ pub(crate) async fn resolve_icon_path(
|
|||||||
Ok(Some(file.to_string_lossy().to_string()))
|
Ok(Some(file.to_string_lossy().to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_not_found_error(error: &crate::Error) -> bool {
|
|
||||||
match error.raw.as_ref() {
|
|
||||||
crate::ErrorKind::FetchError(error) => {
|
|
||||||
error.status() == Some(reqwest::StatusCode::NOT_FOUND)
|
|
||||||
}
|
|
||||||
crate::ErrorKind::LabrinthError(error) => {
|
|
||||||
error.status == Some(reqwest::StatusCode::NOT_FOUND.as_u16())
|
|
||||||
}
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn content_source_kind(link: &InstanceLink) -> ContentSourceKind {
|
fn content_source_kind(link: &InstanceLink) -> ContentSourceKind {
|
||||||
match link {
|
match link {
|
||||||
InstanceLink::Unmanaged => ContentSourceKind::Local,
|
InstanceLink::Unmanaged => ContentSourceKind::Local,
|
||||||
|
|||||||
Reference in New Issue
Block a user