You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep a File Found When a Multi-Step Rename Fails Partway #1109
Two steps move a file in more than one filesystem operation, and an exception between the operations leaves the media where the next run can lose it.
ProcessFile.MakeExtensionLowercase() moves name.MKV to name.tmp7, then moves name.tmp7 to name.mkv. When the second move throws, the media stays at name.tmp7. The result row names name.MKV, which no longer exists. On the next run name.tmp7 is not an MKV file, so with DeleteUnwantedExtensions on, DeleteNonMkvFile() deletes it.
Convert.ReMuxToMkv() moves the remuxed output to the .mkv name before it deletes the input. When the delete throws, the step fails before the caller records the new path or sets modified. The new MKV exists, but the result row reports the old path as not modified.
Reproduction shape
Process name.MKV with DeleteUnwantedExtensions on.
Make the second move in MakeExtensionLowercase() throw, for example with an IO error on a network share.
The media is left at name.tmp7, and the next run deletes it.
Expected
When the second move fails, the step moves the file back to its original name where it can, and reports the path the file is actually at. A remux whose input delete fails reports the output path and the modification.
Found in the review of the per-file exception fix, which keeps processing after such an exception rather than ending the run. The stranding itself does not depend on that fix.
Decision from the maintainer (2026-10-30): include Convert.ConvertToMkv(), which has the same move-then-delete pattern, in this fix.
Claim (backlog burndown round 1, fixed together with #1073): branch feature/1073-1109-rename-collisions, files PlexCleaner/ProcessFile.cs, PlexCleaner/Convert.cs, new PlexCleanerTests/RenameCollisionTests.cs. ARCHITECTURE.md and HISTORY.md are deferred to one final docs pull request by the maintainer's choice, so this group does not touch them.
Activity
ptr727 commentedon Oct 31, 2026
Decision from the maintainer (2026-10-30): include
Convert.ConvertToMkv(), which has the same move-then-delete pattern, in this fix.Claim (backlog burndown round 1, fixed together with #1073): branch
feature/1073-1109-rename-collisions, filesPlexCleaner/ProcessFile.cs,PlexCleaner/Convert.cs, newPlexCleanerTests/RenameCollisionTests.cs.ARCHITECTURE.mdandHISTORY.mdare deferred to one final docs pull request by the maintainer's choice, so this group does not touch them.Fail a Rename Onto an Existing File and Undo a Partial Rename (#1119)