aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src/main.rs
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-03-18 11:51:24 +0800
committerGitHub <noreply@github.com>2026-03-18 11:51:24 +0800
commit983c1dabd044d908540cbbdbc2c8d22cc36f5a82 (patch)
tree170af33437ea80933d2aed37fde90cfef7a91da1 /src-tauri/src/main.rs
parent08bcd364e5f32be457263f665797c2301379efb9 (diff)
downloadDropOut-983c1dabd044d908540cbbdbc2c8d22cc36f5a82.tar.gz
DropOut-983c1dabd044d908540cbbdbc2c8d22cc36f5a82.zip
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'src-tauri/src/main.rs')
-rw-r--r--src-tauri/src/main.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index e7deee7..9d4d17c 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -99,12 +99,17 @@ fn has_unresolved_placeholder(s: &str) -> bool {
}
fn resolve_minecraft_version(version_id: &str) -> String {
- if version_id.starts_with("fabric-loader-") {
- version_id
- .split('-')
- .next_back()
- .unwrap_or(version_id)
- .to_string()
+ if let Some(rest) = version_id.strip_prefix("fabric-loader-") {
+ // Fabric version IDs are of the form: fabric-loader-<loader>-<mc>
+ // After stripping the prefix, we split once to separate loader vs mc
+ let mut parts = rest.splitn(2, '-');
+ let _loader_version = parts.next();
+ if let Some(mc_version) = parts.next() {
+ mc_version.to_string()
+ } else {
+ // Malformed Fabric ID, fall back to original
+ version_id.to_string()
+ }
} else if version_id.contains("-forge-") {
version_id
.split("-forge-")