Skip to content

Fix 5963: 愚人节版本 Minecraft 2.0 的 Legacy Fabric 下载列表为空#6009

Merged
Glavo merged 2 commits into
HMCL-dev:mainfrom
Wulian233:lfabric
Apr 26, 2026
Merged

Fix 5963: 愚人节版本 Minecraft 2.0 的 Legacy Fabric 下载列表为空#6009
Glavo merged 2 commits into
HMCL-dev:mainfrom
Wulian233:lfabric

Conversation

@Wulian233
Copy link
Copy Markdown
Contributor

image

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 26, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a version normalization mechanism for Legacy Fabric versions, specifically converting the '2point0_' prefix to '2.0_' for internal storage while retaining the original metadata version for API calls. A review comment suggests enhancing the robustness of the normalizeVersion method to handle cases where the version string might be exactly '2point0' without a trailing underscore.

Comment on lines +77 to +81
private static String normalizeVersion(String version) {
return version.startsWith("2point0_")
? "2.0_" + version.substring("2point0_".length())
: version;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

这个 normalizeVersion 方法目前仅处理了带有下划线的前缀 2point0_。虽然目前 Legacy Fabric 的 Meta API 可能主要返回这种格式,但为了提高代码的健壮性,建议也处理一下不带下划线的情况(例如直接是 2point0),以防未来 API 返回格式发生变化。

Suggested change
private static String normalizeVersion(String version) {
return version.startsWith("2point0_")
? "2.0_" + version.substring("2point0_".length())
: version;
}
private static String normalizeVersion(String version) {
if (version.startsWith("2point0_")) {
return "2.0_" + version.substring("2point0_".length());
}
return "2point0".equals(version) ? "2.0" : version;
}

@Glavo Glavo merged commit 1b1ba64 into HMCL-dev:main Apr 26, 2026
2 checks passed
@Wulian233 Wulian233 deleted the lfabric branch April 26, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants