Skip to content

Conversation

bozaigao
Copy link
Contributor

No description provided.

@sunnylqm sunnylqm merged commit 8e6d9bf into reactnativecn:master Sep 24, 2025
1 check passed
@sunnylqm sunnylqm requested a review from Copilot September 24, 2025 00:26
Copy link

@Copilot 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 updates the judge logic for v2 in the DownloadTask by separating the resource copying functionality into version-specific methods and implementing proper logic to determine which version to use.

  • Separates the copyFromResource method into v1 and v2 variants with distinct functionality
  • Adds logic to detect v2 format based on the presence of copiesv2 keys
  • Reorganizes the copies processing to handle v1 and v2 formats in separate code paths

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

param.unzipDirectory.mkdirs();
HashMap<String, ArrayList<File>> copyList = new HashMap<String, ArrayList<File>>();
HashMap<String, ArrayList<File>> copiesv2List = new HashMap<String, ArrayList<File>>();
Boolean isV2 = false;
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

Use primitive boolean instead of wrapper Boolean for simple flag variables. This avoids unnecessary object allocation and potential null pointer issues.

Suggested change
Boolean isV2 = false;
boolean isV2 = false;

Copilot uses AI. Check for mistakes.

if (from.isEmpty()) {
from = to;
Iterator<?> keysV2 = copiesv2.keys();
if(keysV2.hasNext()){
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing space after if keyword. Consider using if (keysV2.hasNext()) for consistent code formatting.

Suggested change
if(keysV2.hasNext()){
if (keysV2.hasNext()) {

Copilot uses AI. Check for mistakes.

String canonicalPath = toFile.getCanonicalPath();
if (!canonicalPath.startsWith(param.unzipDirectory.getCanonicalPath() + File.separator)) {
throw new SecurityException("Illegal name: " + to);
}else{
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing space before opening brace. Consider using } else { for consistent code formatting.

Suggested change
}else{
} else {

Copilot uses AI. Check for mistakes.

Comment on lines +414 to +416
if(isV2){
copyFromResourceV2(copiesv2List);
}else{
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing spaces around if and else keywords. Consider using if (isV2) { and } else { for consistent code formatting.

Suggested change
if(isV2){
copyFromResourceV2(copiesv2List);
}else{
if (isV2) {
copyFromResourceV2(copiesv2List);
} else {

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.

2 participants