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.
pixelfed/tests/Feature/MediaPipeline
Ashley f8a85edcb6 fix: delete superseded media file only after the db save commits
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 Make blurhash gd-fallback test probe decode-time availability instead of skipping 1 month ago
ImageThumbnailSupersedeTest.php fix: delete superseded media file only after the db save commits 1 week ago
MediaDeletePipelineTest.php Fix account storage limit not freeing on media deletion (#7169) 2 months ago