Files
P2H 84b296e0d6 Import: optional backup copy that mirrors the destination (#4840) (#4847)
* Import: optional backup copy that mirrors the destination (#4840)

Copy and Move imports can make a second, verified copy of each file in a
backup folder (dialog: Backup to; library.import: backup). The backup takes
the path the main copy ended up with, relative to the destination, so
folder and rename templates, sequence numbers, the -1 of a taken name and
Copy as DNG all carry over: the backup mirrors the destination.

Each backup gets the check Copy runs (copy_verified: a new file, synced,
checked against the probe hash or byte for byte); a bad one is removed and
reported in backupFailed. A Move keeps the original of a photo whose backup
failed. A different file already at the backup's place is left alone and
reported, never renamed. A backup with mode add, or a backup folder that is,
is inside or contains the destination, is refused up front.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Import backup: address review findings (#4840)

- A backup place that is the file being imported (a backup folder set to
  the card) is not a backup: it is reported, and a Move keeps the original
  instead of deleting the only copy.
- The backup folder check runs when library.import's params are checked,
  so the import dialog refuses it before creating a new album.
- The "outside the destination" check also compares the folders with
  links resolved through their nearest existing ancestor, so a backup
  folder that doesn't exist yet can't slip inside the destination.
- A photo browsed in Local that a Copy or Move adds in place is reported
  in backupFailed.
- docs/user describes the latest release only: the import guide's backup
  step is held back until a release ships the option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Import backup: resolve `..` and relative backup paths; refuse a backup on the main copy (#4840)

- import_move::resolved makes a path absolute and follows it part by part:
  links of the parts that exist are resolved, and a `..` after a part that
  doesn't exist yet steps back from it (it used to stop there and compare
  the path unresolved, so <base>/missing/../out/bk got past the "outside
  the destination" check).
- back_up also refuses a backup place that is the main copy or one of a
  Move's placed sidecars, not only the original.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Import backup: compare backup and destination in one path form (#4840)

On Windows, import_move::resolved gave a path whose first folder exists in
the \?\C:\ form canonicalizing returns, and one whose first folder doesn't
in the plain C:\ form; Path::starts_with told them apart, so a backup
inside a destination that doesn't exist yet could pass the overlap check.
resolved now always returns the plain form, and compare_key (used by the
overlap check and the backup-is-the-file check) also ignores letter case
on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Import backup: check folder overlap on resolved paths only (#4840)

backup_folder_error also ran import_move::inside, which compares the raw
paths first, so a folder beside the destination named through it
(<dest>/../bk) was refused as inside it. The resolved comparison
(compare_key: absolute, links and `..` followed) already covers equal and
nested folders, so the raw checks are dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* add my real name in contributors

* Import backup: a Move checks its backup again before removing the original (#4840)

The backup path a transfer made was dropped from the Move's bookkeeping,
so finish_moves checked only the main copy: a backup removed (or a backup
drive unplugged) while the catalog was committed and saved still let the
original be deleted. The path is now carried to finish_moves, and
import_move::backup_intact checks the photo's backup and its sidecars'
against the placed copies before the source is removed; when it fails the
original stays, reported in kept like a backup that failed outright.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:40:11 +01:00
..