Skip to content

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Oct 28, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 28, 2025 13:39
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 PR adds support for allowing duplicate filenames when exporting game logs to a ZIP file. When duplicate entries are encountered, the system will automatically append a numeric suffix (e.g., .1, .2) to avoid conflicts, with a maximum of 10 attempts before throwing an exception.

Key changes:

  • Modified Zipper class to optionally track entry names and handle duplicates by appending numeric suffixes
  • Updated LogExporter to enable duplicate entry handling when creating log export archives

Reviewed Changes

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

File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/util/io/Zipper.java Added duplicate entry handling mechanism with allowDuplicateEntry flag and newEntry() method to generate unique names
HMCL/src/main/java/org/jackhuang/hmcl/game/LogExporter.java Enabled duplicate entry support when creating the zipper for log exports

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

if (attrs.isDirectory()) {
try {
zos.putNextEntry(entry);
entryNames.add(entry.getName());
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

Potential NullPointerException when allowDuplicateEntry is false. The code attempts to call entryNames.add() but entryNames is null when allowDuplicateEntry is false. This line should be guarded with a null check or only execute when entryNames is not null.

Suggested change
entryNames.add(entry.getName());
if (entryNames != null) {
entryNames.add(entry.getName());
}

Copilot uses AI. Check for mistakes.
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