Skip to content

fix: await archiver import before traversing in folders:download --zip - #721

Merged
arjankowski merged 1 commit into
mainfrom
fix/folders-download-zip-race
Sep 11, 2026
Merged

fix: await archiver import before traversing in folders:download --zip#721
arjankowski merged 1 commit into
mainfrom
fix/folders-download-zip-race

Conversation

@arjankowski

@arjankowski arjankowski commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Note: This is a cherry-pick of #719 by @dgilman-perplexity. The original PR was submitted from a fork, which means GitHub does not expose repository secrets to CI — causing the FOSSA license scan to fail. This PR re-applies the same commit from an internal branch so all CI checks can pass.

Since the archiver 8 upgrade, _setupZip() awaits a dynamic import before assigning this.zip, but run() started folder traversal without waiting for it. When the first folder listing returned before the module loaded, items took the non-zip path, the archive was never finalized and the .zip was left empty (or the command hung).

Load the module up front and keep _setupZip() synchronous so this.zip exists before the first item is processed. Add a regression test that asserts the archive is initialized before _getItems() runs, and verify the entries of the produced archive in the existing --zip test.

Fix for #718

@coveralls

coveralls commented Sep 11, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 34595979007

Coverage at 84.916% (no base build to compare)

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 6061
Covered Lines: 5396
Line Coverage: 89.03%
Relevant Branches: 2153
Covered Branches: 1579
Branch Coverage: 73.34%
Branches in Coverage %: Yes
Coverage Strength: 642.63 hits per line

💛 - Coveralls

@arjankowski arjankowski changed the title fix: await archiver import before traversing in folders:download --zip fix: await archiver import before traversing in folders:download --zip Sep 11, 2026
Comment thread src/commands/folders/download.js Outdated
KwiatkowskiML
KwiatkowskiML previously approved these changes Sep 11, 2026
Since the archiver 8 upgrade, _setupZip() awaits a dynamic import before assigning this.zip, but run() started folder traversal without waiting for it. When the first folder listing returned before the module loaded, items took the non-zip path, the archive was never finalized and the .zip was left empty (or the command hung).
Load the module up front and keep _setupZip() synchronous so this.zip exists before the first item is processed. Add a regression test that asserts the archive is initialized before _getItems() runs, and verify the entries of the produced archive in the existing --zip test.

Co-authored-by: Artur Jankowski <ajankowski@box.com>

@KwiatkowskiML KwiatkowskiML left a comment

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.

LGTM

@arjankowski
arjankowski merged commit 8cab5bc into main Sep 11, 2026
20 checks passed
@arjankowski
arjankowski deleted the fix/folders-download-zip-race branch September 11, 2026 11:57
@dgilman-perplexity

Copy link
Copy Markdown
Contributor

@arjankowski Awesome, thank you. How long until a new version is cut?

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.

5 participants