Both import_one and import_season_pack_file deleted the existing episode_file row and unlinked the on-disk file *before* link_or_copy_file placed the new one. If the link/copy (or the free-space check) then failed, the original content and its DB row were already gone with nothing to fall back to. Now the stale file is renamed to a sibling (freeing dest for the hardlink fast path, same as before) and the DB row is left alone. Only after the replacement is confirmed on disk are the file and the old row cleaned up; any failure in between restores the original file before returning the error. |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||