Skip to content

fix(downloader): remove the partial file of a failed download - #166

Merged
roxblnfk merged 1 commit into
1.xfrom
fix/failed-download-cleanup
Oct 12, 2026
Merged

roxblnfk merged 1 commit into
1.xfrom
fix/failed-download-cleanup

Conversation

@roxblnfk

Copy link
Copy Markdown
Member

🔍 What was changed

  • A failed asset download now removes its partial <tempDir>/<asset name> file; before, the cleanup unlinked the temp directory (SplFileObject::getPath()) and silently failed, leaving one file per release DLoad fell back from.
  • The file handle is released before the delete.

Checklist

Review notes

  • On PHP 8.2 / Windows 11, unlink() of a file still open through SplFileObject already succeeds and the name disappears at once, so the handle release is a safeguard for filesystems without POSIX delete semantics rather than the fix itself.
  • Two parallel downloads of the same asset still share one temp file name. The name cannot simply be randomized: the installer uses the downloaded file's name (Installation::moveToDestination(), archive detection by extension), so a fix needs a per-download subdirectory and its cleanup in the installer — left for a separate change.

The cleanup unlinked `SplFileObject::getPath()`, which is the temp directory, so every release DLoad fell back from left its asset file behind.

The handle is dropped before the delete so the name is freed at once on Windows filesystems without POSIX delete semantics.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added bug Something isn't working tests labels Oct 12, 2026
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/Module/Downloader/Downloader.php 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roxblnfk
roxblnfk merged commit 9251857 into 1.x Oct 12, 2026
23 checks passed
@roxblnfk
roxblnfk deleted the fix/failed-download-cleanup branch October 12, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed downloads leave partial files in the temp directory

1 participant