mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
handleImageTransform deleted the previous (superseded) file before
$media->save() persisted the new path. If the save failed or the worker
died in that window, the row still pointed at the old path whose bytes
were already gone, losing the upload. Reorder so the delete runs only
after the save succeeds; a leftover orphan after a rare post-save crash
is harmless, a row pointing at deleted bytes is not. Covers both the
base image and thumbnail paths (shared method). Comment updated to match.
Added a regression test that forces the save to throw and asserts the
superseded file survives, plus the existing success-path coverage.
Verification (run in worktree):
./vendor/bin/pest tests/Feature/MediaPipeline/ImageThumbnailSupersedeTest.php
-> 3 passed (8 assertions)
new save-failure test against the original ordering -> FAILS (guard valid)
./vendor/bin/pint app/Util/Media/Image.php tests/Feature/MediaPipeline/ImageThumbnailSupersedeTest.php
-> PASS, 2 files
|
1 week ago | |
|---|---|---|
| .. | ||
| BlurhashTest.php | 1 month ago | |
| ImageThumbnailSupersedeTest.php | 1 week ago | |
| MediaDeletePipelineTest.php | 2 months ago | |