Skip to content

Commit 93e5d58

Browse files
committed
Fix deserializer error for client/server only versions
1 parent 3b96fa4 commit 93e5d58

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ornithe-installer-rs"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
edition = "2024"
55
authors = [
66
"moehreag"

src/net/manifest.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,15 @@ impl MinecraftVersion {
129129
pub async fn get_jar_download_url(
130130
&self,
131131
side: &GameSide,
132-
) -> Result<VersionDownload, reqwest::Error> {
132+
) -> Result<VersionDownload, InstallerError> {
133133
let downloads = fetch_version_details(self).await?.downloads;
134-
Ok(match side {
134+
match side {
135135
GameSide::Client => downloads.client,
136136
GameSide::Server => downloads.server,
137-
})
137+
}
138+
.ok_or(InstallerError(
139+
"Version does not have download for side ".to_owned() + side.id(),
140+
))
138141
}
139142

140143
pub fn is_snapshot(&self) -> bool {
@@ -163,8 +166,8 @@ pub struct VersionDetails {
163166

164167
#[derive(Deserialize)]
165168
struct VersionDownloads {
166-
client: VersionDownload,
167-
server: VersionDownload,
169+
client: Option<VersionDownload>,
170+
server: Option<VersionDownload>,
168171
}
169172

170173
#[allow(dead_code)]

0 commit comments

Comments
 (0)