+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

fix: catalog source fallback #532

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/core/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ pub enum Source {
WowI,
#[serde(alias = "townlong-yak")]
TownlongYak,
#[serde(other)]
Other,
}

impl std::fmt::Display for Source {
Expand All @@ -76,6 +78,9 @@ impl std::fmt::Display for Source {
Source::Tukui => "Tukui",
Source::WowI => "WowInterface",
Source::TownlongYak => "TownlongYak",

// This is a fallback option.
Source::Other => "Unknown",
};
write!(f, "{}", s)
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,7 @@ impl std::fmt::Display for CatalogSource {
catalog::Source::Tukui => "Tukui",
catalog::Source::WowI => "WowInterface",
catalog::Source::TownlongYak => "Townlong-Yak",
catalog::Source::Other => panic!("Unspported catalog source"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine to panic! in the std::fmt::Display since we don't want to render this to the GUI.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! The only way it'll expose itself in the GUI and make allow any catalog items for it to display is if you add it to the CatalogSource::all method. Since we left it out, these should be unreachable and it'd be impossible to show those items in the GUI.

},
};
write!(f, "{}", s)
Expand Down
1 change: 1 addition & 0 deletions src/gui/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,7 @@ async fn perform_fetch_latest_addon(
catalog::Source::Tukui => RepositoryKind::Tukui,
catalog::Source::WowI => RepositoryKind::WowI,
catalog::Source::TownlongYak => RepositoryKind::TownlongYak,
catalog::Source::Other => panic!("Unspported catalog source"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine to panic! since it shouldn't be possible to end here with a catalog::Source::Other.

};

RepositoryPackage::from_repo_id(flavor, kind, id)?
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载