Repository navigation
fix(mcpb): keep upload rename destination absent on Windows - #1314
Merged
samanhappy merged 2 commits intoOct 15, 2026
Merged
samanhappy merged 2 commits into
samanhappy merged 2 commits into
Conversation
Valid admin MCPB uploads reach installation but fail with EPERM on Windows because the extracted directory is renamed onto a pre-created destination. Clear the validated exact destination if cleanup left it behind, then move the extraction into place. Existing overwrite, admin, name and containment checks remain unchanged. The existing real-filesystem upload regression fails on the base and passes after this change on Windows.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1314 +/- ##
=======================================
Coverage ? 61.05%
=======================================
Files ? 235
Lines ? 19608
Branches ? 4948
=======================================
Hits ? 11972
Misses ? 6025
Partials ? 1611
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Comment on lines
+169
to
+170
| if (fs.existsSync(finalExtractDir)) { | ||
| fs.rmSync(finalExtractDir, { recursive: true, force: true }); |
11 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Valid admin MCPB uploads fail at installation on Windows:
/api/mcpb/uploadpre-creates the destination directory and then renames the extracted archive onto it. Windows rejects that directory rename withEPERM, so the existing upload test receives HTTP 500 instead of success.Ensure the destination is absent before moving the extracted directory into place. The existing old-installation cleanup catches its own errors, so recheck and remove the validated exact destination if it remains. The server-name and path-containment validation, admin gates, extraction and response contracts stay the same. Existing overwrite behavior already removes the previous installation before the rename; this does not add transactional rollback.
Validation on Windows, Node 22.20.0 and pinned pnpm 10.12.4:
tests/controllers/mcpbController.test.tsreproduces the base failure (one failed / three passed) and passes at the fix (four passed), including unsafe-name and admin rejection. No test was changed.joseload problem, and nine other failures were already present on the base.The full suite/builds were not rerun during the independent review. POSIX compatibility follows from using an absent rename destination; no fresh Linux, live dashboard or hosted-CI run is claimed. This fixes a self-discovered portability defect in the existing MCPB feature without changing workflows or dependencies.