mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 07:17:50 +00:00
Merge pull request #90 from mxve/github-check
maint: handle missing tag_name from github's JSON reply
This commit is contained in:
@@ -10,8 +10,16 @@ pub async fn latest_tag(owner: &str, repo: &str) -> String {
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let github_json: serde_json::Value = serde_json::from_str(&github_body).unwrap();
|
||||
github_json["tag_name"].to_string().replace('"', "")
|
||||
|
||||
if let Some(tag_name) = github_json.get("tag_name") {
|
||||
if let Some(tag_name_str) = tag_name.as_str() {
|
||||
return tag_name_str.to_string().replace('"', "");
|
||||
}
|
||||
}
|
||||
|
||||
"0.0.0".to_string()
|
||||
}
|
||||
|
||||
pub async fn latest_version(owner: &str, repo: &str) -> Version {
|
||||
|
||||
Reference in New Issue
Block a user