Skip to content

Conversation

@burningtnt
Copy link
Member

@burningtnt burningtnt commented Dec 19, 2025

该 PR 建议在 #5026 后合并,否则可能会 DOS 服务器

@burningtnt burningtnt marked this pull request as ready for review December 20, 2025 12:33
@burningtnt burningtnt changed the title Fix #4977 Fix #4977 Modrinth 依赖可以指向已经被删除的项目 Dec 20, 2025
@Glavo Glavo requested a review from Copilot December 20, 2025 12:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes issue #4977 where Modrinth dependencies can point to deleted projects that no longer exist. The fix introduces a graceful degradation mechanism that returns a BROKEN sentinel value instead of throwing exceptions when resolving dependencies that point to deleted projects.

Key Changes

  • Introduces a new resolveDependency() method in the RemoteModRepository interface with a default implementation that delegates to getModById()
  • Implements special error handling in ModrinthRemoteModRepository.resolveDependency() to catch errors for deleted projects (502 errors and FileNotFoundException) and return RemoteMod.BROKEN
  • Refactors dependency loading in DownloadPage to use asynchronous parallel loading, preventing UI blocking when multiple dependencies need to be resolved

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/RemoteModRepository.java Adds default resolveDependency() method to the interface that delegates to getModById()
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/modrinth/ModrinthRemoteModRepository.java Overrides resolveDependency() to handle deleted projects by catching 502 and FileNotFoundException errors; also expands wildcard imports to explicit imports
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/RemoteMod.java Updates Dependency.load() to use resolveDependency() instead of getModById() for graceful handling of deleted dependencies
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java Refactors loadDependencies() from synchronous to asynchronous parallel loading using Task API to prevent UI blocking; expands wildcard imports to explicit imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant