Repository navigation
Skip a Lightroom image whose file, folder or root reference isn't an id - #4097
THEtheChad wants to merge 1 commit into
Conversation
…is not an id is skipped Adobe_images.rootFile, AgLibraryFile.folder and AgLibraryFolder.rootFolder were read with number(), which reads a NULL, text or non-finite value as 0 and truncates 1.5 to 1. An image with such a reference took the path of the record with that id and merged into its photo, replacing that photo's rating and catalog data. They are now read as whole numbers (id_of); an image whose reference names no record is skipped as missingFile, missingFolder or missingRoot.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…e isn't an id is skipped An image whose rootFile, folder or rootFolder reference was missing, NULL, text or a fraction resolved to record 0 (or 1 for 1.5) and could merge into another photo. It is now skipped with the existing missing-file/folder/root reasons. Generalises the #4090 image_of helper into id_of. Hand-ported into the fork's reader; unit test for id_of added. Adapted from upstream #4097 (head 1f850ace97) Co-authored-by: THEtheChad <THEtheChad@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…an id joins no album A member row whose collection was missing, NULL, text or a fraction joined collection 0 (or the truncated id). It now joins no album, with one warning. Hand-ported into the fork's reader, reusing the id_of helper from #4097; test added. Adapted from upstream #4098 (head 85435de01f) Co-authored-by: THEtheChad <THEtheChad@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
This applies cleanly to main, and the strict #4098 adds the same function and the same test name, and #4090 has |
Fixes #4094
Problem
The reader finds an image's original through
Adobe_images.rootFile→AgLibraryFile.folder→AgLibraryFolder.rootFolder. It read all three withnumber(), which turns a missing, NULL or text value into 0 and truncates 1.5 to 1. So an image with a bad reference took the path of record 0, or of record 1 for 1.5. When that path was another image's original, the two imported as one photo, and the later image overwrote the first one's rating and catalog data without a warning. This was reproduced with crafted catalogs; whether Lightroom writes such references hasn't been established.Change
crates/engine/src/lightroom_catalog.rs:id_of(row, column)reads a reference as a whole number. It returnsNonefor a missing, NULL, text, fractional or out-of-i64-range value. Integers go through f64 the same wayid_localdoes, so ids past 2^53 still match.read_fileresolves the three references throughid_of. A bad one skips the image with the existing reason,missingFile,missingFolderormissingRoot, and the image's virtual copies go with it.SkipReasondocs anddocs/lightroom-catalog-import.mdsay so. A literal 0 still names record 0, and a whole REAL 1.0 names record 1.Tests
New in
lightroom_catalog/tests.rs:an_image_whose_path_reference_is_not_a_whole_number_is_skipped(12 cases),an_image_naming_no_file_does_not_merge_into_the_photo_of_file_0anda_reference_names_a_record_only_by_a_whole_number. Onmain's file, with onlyid_ofadded, the first two fail (104 passed, 2 failed). Reverting any one of the three lines fails its four cases.cargo xtask cipassed all 9 steps on 1f850ac (onmainc2e9c45). Withlightcraft-clion crafted catalogs,mainmerges the bad image into another photo and changes its rating; this branch skips it. Well-formed catalogs, with ids past 2^53 or REAL 1.0 references, import as onmain. The desktop app was not run.Notes
image) and A Lightroom album member whose collection isn't an id joins no album #4098 (members'collection). A Lightroom album member whose collection isn't an id joins no album #4098 adds the sameid_ofand its test in the same places. Each pair merges cleanly in either order.number(), left for a separate change: a record's ownid_local,masterImage, a keyword'stagandparent, and a collection'sparent.