Fix cross-folder links leaving the original next to the new link
When a match lives in another folder than the master (e.g. Game Rips/ vs Video Games/), linking creates the new link at the master's path and then removes the original. That removal re-checked the original's modification time, which FUSE filesystems such as Unraid's /mnt/user can report inconsistently; the check then failed after the link was already made, leaving both files and a failed operation whose quarantine copy was hidden. - Once the original is quarantined, verify it by identity (same inode as the quarantine copy) instead of by timestamp. Identical files without a quarantine copy keep the strict check, now with a detailed error. - If the original still cannot be removed, roll back: remove the new link and the unneeded quarantine copy so nothing changes. If the original was swapped for another file mid-way, its quarantine copy is kept. - Linking again when the master's path already holds a hardlink of the master only retires the leftover original, which cleans up files left by the old behaviour; undo then keeps that pre-existing link (migration 5 records this). - Promote gets the same identity check and rollback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e848cd765
commit
176a527ec7
4 files changed
+237
-23
No files matched your search
@@ -114,6 +114,10 @@ var migrations = []string{
|
||||
// matches that are not at the same path (other format, approximate, ...).
|
||||
`ALTER TABLE operations ADD COLUMN match_kind TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE operations ADD COLUMN match_reason TEXT NOT NULL DEFAULT '';`,
|
||||
|
||||
// 5: a link whose target already existed (only the original was retired);
|
||||
// undo must then leave that target alone.
|
||||
`ALTER TABLE operations ADD COLUMN link_preexisted INTEGER NOT NULL DEFAULT 0;`,
|
||||
}
|
||||
|
||||
// Open opens (and migrates) the database in dataDir.
|
||||
|
||||
Reference in new issue
Block a user