diff --git a/Cargo.lock b/Cargo.lock index 35c28413e1..06133c4e0d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1330,6 +1330,15 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" +[[package]] +name = "constant_time_eq" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144e7f1de087984240b7816d47f698b414979faa6f40839c5b86d6bd47db57b7" +dependencies = [ + "rustversion", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -2354,7 +2363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -8390,7 +8399,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -9223,10 +9232,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.3", + "getrandom 0.3.4", "once_cell", "rustix 1.1.6", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -10297,7 +10306,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -11100,10 +11109,11 @@ dependencies = [ [[package]] name = "zip" -version = "9.2.2" +version = "9.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e408c6cc4699dd017d53dc080cd51c2cea2b5354af57a1479bd265ed42911487" +checksum = "2d8dbe089cf6b0448b78f5fc50139ab5aaa40d08ac07cdc1baf2c13add35fcce" dependencies = [ + "constant_time_eq", "crc32fast", "flate2", "getrandom 0.4.3", @@ -11113,6 +11123,7 @@ dependencies = [ "nix", "typed-path", "windows-sys 0.61.2", + "zeroize", ] [[package]] diff --git a/crates/engine/src/cmd/browse.rs b/crates/engine/src/cmd/browse.rs index 927e3583de..514a43f3d8 100644 --- a/crates/engine/src/cmd/browse.rs +++ b/crates/engine/src/cmd/browse.rs @@ -284,7 +284,8 @@ pub fn specs() -> Vec { "{path, name}: rename a folder on disk (its files and sidecars go along) and relink the photos in it; one undo step (undo renames it back, refused if the old name is taken) → {path, relinked}", always, |s, p| { - let from = str_param(p, "path").ok_or_else(|| bad("folder.rename", "missing path"))?.trim_end_matches(['/', '\\']).to_string(); + let from = str_param(p, "path").ok_or_else(|| bad("folder.rename", "missing path"))?.trim_end_matches(['/', '\\']); + let from = library_spelling(s, from); let name = str_param(p, "name") .map(str::trim) .filter(|n| !n.is_empty() && !n.contains(['/', '\\']) && *n != "." && *n != "..") @@ -302,10 +303,11 @@ pub fn specs() -> Vec { "{path, into: destination folder}: move a folder on disk into another and relink the photos in it; one undo step (undo moves it back, refused if the old place is taken) → {path, relinked}", always, |s, p| { - let from = str_param(p, "path").ok_or_else(|| bad("folder.move", "missing path"))?.trim_end_matches(['/', '\\']).to_string(); - let into = str_param(p, "into").ok_or_else(|| bad("folder.move", "missing into"))?; + let from = str_param(p, "path").ok_or_else(|| bad("folder.move", "missing path"))?.trim_end_matches(['/', '\\']); + let from = library_spelling(s, from); + let into = library_spelling(s, str_param(p, "into").ok_or_else(|| bad("folder.move", "missing into"))?); let name = Path::new(&from).file_name().ok_or_else(|| bad("folder.move", "bad path"))?; - let to = Path::new(into).join(name).to_string_lossy().to_string(); + let to = Path::new(&into).join(name).to_string_lossy().to_string(); let n = move_folder(s, &from, &to).map_err(|e| bad("folder.move", e))?; Ok(json!({"path": to, "relinked": n})) } @@ -561,6 +563,43 @@ fn follow_library_folder(chosen: &mut Option, from: &str, to: &str) { } } +/// `path` spelled the way the open library spells its own folder, when the two differ only in +/// letter case and name the same folder on disk (a volume that ignores letter case: Windows, +/// macOS); `path` as given otherwise. The library's photos are stored under its own spelling, so a +/// folder rename or move named through another spelling would match none of them and leave them +/// pointing at the old folder (upstream #4816; written for the fork, which compares the library's +/// protected folders on disk already). +fn library_spelling(s: &Session, path: &str) -> String { + let Some(lib) = s.library.as_ref().map(|l| l.dir.as_path()) else { return path.to_string() }; + let given = Path::new(path); + let Some(rest) = case_only_rest(given, lib) else { return path.to_string() }; + // the spelling given must be the library's own folder on disk: a volume that tells letter case + // apart can hold `LIB` next to `lib`, and then it is another folder + let prefix: std::path::PathBuf = given.components().take(lib.components().count()).collect(); + let same = matches!((prefix.canonicalize(), lib.canonicalize()), (Ok(a), Ok(b)) if a == b); + if !same { + return path.to_string(); + } + let spelled = if rest.as_os_str().is_empty() { lib.to_path_buf() } else { lib.join(rest) }; + spelled.to_string_lossy().to_string() +} + +/// What follows `lib` in `path` when `path` begins with `lib`'s names in other letter case; +/// `None` when it begins with `lib` exactly (nothing to respell) or with other names. +fn case_only_rest(path: &Path, lib: &Path) -> Option { + if path.starts_with(lib) { + return None; + } + let mut names = path.components(); + for l in lib.components() { + let p = names.next()?; + if p.as_os_str().to_string_lossy().to_lowercase() != l.as_os_str().to_string_lossy().to_lowercase() { + return None; + } + } + Some(names.as_path().to_path_buf()) +} + /// Rename or move a folder on disk (everything in it goes along, sidecars included) and relink /// the photos inside, as one undo step: undo renames the folder back and restores the photos' /// paths, redo repeats the move — each refused (and reported) when the destination is taken. @@ -618,3 +657,21 @@ pub(crate) fn move_folder(s: &mut Session, from: &str, to: &str) -> std::result: follow_folder(s, from, to); Ok(n) } + +#[cfg(test)] +mod tests { + use super::case_only_rest; + use std::path::{Path, PathBuf}; + + #[test] + fn a_path_that_differs_only_in_letter_case_is_respelled_under_the_library() { + let lib = Path::new("/photos/lib"); + assert_eq!(case_only_rest(Path::new("/photos/LIB/Originals/day"), lib), Some(PathBuf::from("Originals/day"))); + assert_eq!(case_only_rest(Path::new("/Photos/Lib"), lib), Some(PathBuf::new()), "the library itself"); + assert_eq!(case_only_rest(Path::new("/photos/lib/Originals/day"), lib), None, "spelled exactly: nothing to respell"); + assert_eq!(case_only_rest(Path::new("/photos/library/Originals"), lib), None, "another name is another folder"); + assert_eq!(case_only_rest(Path::new("/photos"), lib), None, "a shorter path is not inside"); + assert_eq!(case_only_rest(Path::new(""), lib), None); + assert_eq!(case_only_rest(Path::new("photos/LIB"), lib), None, "a relative path is not the library"); + } +} diff --git a/crates/engine/src/tests_folders.rs b/crates/engine/src/tests_folders.rs index 410d748165..3ba345c295 100644 --- a/crates/engine/src/tests_folders.rs +++ b/crates/engine/src/tests_folders.rs @@ -909,6 +909,35 @@ fn a_date_folder_inside_the_library_can_be_renamed_but_the_librarys_own_folders_ assert!(lib.join("Originals").is_dir()); } +/// On a volume that ignores letter case (Windows, macOS), the library's folder named with other +/// letter case (`LIB/Originals/day` for `lib/Originals/day`) is the same folder: a rename through +/// that spelling relinks the photos stored under the library's own spelling, instead of moving the +/// folder on disk and leaving them pointing at the old one (upstream #4816). +#[test] +fn a_date_folder_named_with_other_letter_case_is_renamed_and_its_photos_follow() { + let dir = Scratch::new("in-library-case"); + let lib = dir.0.join("lib"); + let mut s = Session::new(); + s.open_library(&lib, false).unwrap(); + let day = lib.join("Originals").join("2026-10-16"); + std::fs::create_dir_all(&day).unwrap(); + let a = add_file(&mut s, &day.join("a.jpg").to_string_lossy(), "A"); + let shouted = dir.0.join("LIB").join("Originals").join("2026-10-16"); + if !shouted.is_dir() { + lcc_testkit::skip!(System, "this volume tells letter case apart"); + return; + } + let r = s.execute("folder.rename", &json!({"path": shouted.to_string_lossy(), "name": "Beach"})).unwrap(); + let moved = lib.join("Originals").join("Beach"); + assert_eq!(r["relinked"], 1, "the photo inside is relinked: {r}"); + assert_eq!(r["path"], moved.to_string_lossy().as_ref(), "the result names the library's own spelling"); + assert!(moved.join("a.jpg").is_file()); + assert_eq!(file_of(&s, a), moved.join("a.jpg").to_string_lossy(), "the catalog follows the photo"); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(day.is_dir(), "undo names it back"); + assert_eq!(file_of(&s, a), day.join("a.jpg").to_string_lossy()); +} + #[cfg(unix)] #[test] fn the_library_folder_is_protected_however_its_path_is_spelled() { diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rs index db45d8d58d..16330b5a89 100644 --- a/crates/ui-egui/src/panels/dialogs.rs +++ b/crates/ui-egui/src/panels/dialogs.rs @@ -1829,7 +1829,23 @@ pub fn show(app: &mut LccApp, ctx: &egui::Context) { crate::widgets::named(ui.add(egui::TextEdit::multiline(&mut wm.text).desired_rows(2).hint_text(crate::i18n::tr("© Your Name")).desired_width(f32::INFINITY)), crate::i18n::tr("Text")) }); } - choices(ui, "Position", "watermarkDialogAnchor", &WM_POSITIONS, &mut wm.anchor); + // a 3 × 3 grid laid out like the corners, edges and centre it picks (ids as before: + // `button:watermarkDialogAnchor-{0..8}`; adapted from upstream #4720) + field(ui, "Position", |ui| { + ui.vertical(|ui| { + ui.spacing_mut().item_spacing = egui::vec2(2.0, 2.0); + for (r, row) in WM_POSITIONS.chunks(3).enumerate() { + ui.horizontal(|ui| { + for (c, (v, l)) in row.iter().enumerate() { + let i = r * 3 + c; + if crate::widgets::text_button(ui, &format!("watermarkDialogAnchor-{i}"), l, wm.anchor == *v).clicked() { + wm.anchor = *v; + } + } + }); + } + }); + }); choices(ui, "Rotate", "watermarkDialogRotation", &[(0u16, "0°"), (90, "90°"), (180, "180°"), (270, "270°")], &mut wm.rotation); let mut size = wm.size as f64 * 100.0; if !graphic && num(ui, &WM_SIZE, &mut size) { diff --git a/docs/manual-site/src/content/docs/output/export-metadata-watermark.mdx b/docs/manual-site/src/content/docs/output/export-metadata-watermark.mdx index 16c65a5bb2..aab0dfd245 100644 --- a/docs/manual-site/src/content/docs/output/export-metadata-watermark.mdx +++ b/docs/manual-site/src/content/docs/output/export-metadata-watermark.mdx @@ -17,7 +17,7 @@ import { Aside } from '@astrojs/starlight/components'; - **Watermark** checkbox with a live preview on the photo. - **Style**: **Text** or **Graphic** (an image file). - **Text direction**: **Horizontal text** or **Vertical text** (columns run down, a newline starts the next column to the left; built for Japanese). -- **Position**: nine anchors; **Rotate** 0°, 90°, 180°, 270°. +- **Position**: nine anchors in a 3 × 3 grid laid out like the corners, edges and centre they pick; **Rotate** 0°, 90°, 180°, 270°. - **Size** (% of short edge), **Opacity**, **Horizontal / Vertical inset**, **Shadow**. - 🟡 Complex scripts: Thai mark positioning is incomplete and Arabic is not supported in the watermark. Japanese and Chinese need the bundled CJK fonts. - Vertical text keeps Latin upright; no rotated runs, tate-chu-yoko or ruby. diff --git a/docs/upstream-pr-reviews/ledger.md b/docs/upstream-pr-reviews/ledger.md index f66e92ea45..56f68d810a 100644 --- a/docs/upstream-pr-reviews/ledger.md +++ b/docs/upstream-pr-reviews/ledger.md @@ -1070,6 +1070,19 @@ PR head or commit SHA. A pipe inside a cell is escaped with a backslash. | #4441 | open | Rotate radial gradient by dragging just outside it | LEARN | #3988 lands | Stacked on unmerged #3988, fork-owned masking UI; idea: rotate ring 18 pt outside the selected radial | `a284260226` | 2026-11-17 @ aa08a77060 | - | | #4442 | open | Albums panel: folders and albums mix when ordered by hand | LEARN | upstream approval | crates/catalog is owned and album_order_key diverged; follow-up: hand-port mixed ordering and album.reorder accepting a folder | `4df358b526` | 2026-11-17 @ aa08a77060 | - | | #4443 | open | Mouse wheel resizes brush and radial while masking | LEARN | CI green | Fork-owned masking UI; idea: wheel scales brush or hovered radial ×1.1 per notch, one undo step | `c3ac9c918c` | 2026-11-17 @ aa08a77060 | - | +| #1900 | merged | Plain labels are no longer drag-selectable, as in Lightroom | LEARN | - | Only fork-owned ui-egui (theme, info panel, problem panel, dialogs). The fork still has egui's selectable plain labels; the idea (`selectable_labels = false` in the theme, with `Label::selectable(true)` on values meant for copying) is a small UI follow-up that needs a sweep of the fork's copyable labels. | `8e2aed6623` | 2026-11-27 @ 5973d956df | - | +| #2018 | merged | Workspace: rust-version 1.95 | SKIP | - | Empty diff when merged; the fork's workspace already declares `rust-version = "1.95"`. | `3f4ef77159` | 2026-11-27 @ 5973d956df | - | +| #2194 | merged | MENU-BAR: every command has a place in the menus, and View drops from 63 rows | LEARN | - | Menu layout in upstream's menubar plus menu-path edits in engine command specs and 17 locales; the fork owns its menus (`menus.rs`, `lrc_menus.rs`). Idea: give every command a slot and keep the end-of-menu fallback empty with a test. | `4f2150f97f` | 2026-11-27 @ 5973d956df | - | +| #2838 | merged | Lightroom import: keep compressed history-step and snapshot settings in the archive | SKIP | - | Already in the fork as its own change: fork #632 (d08f388ee) decodes compressed history steps and snapshots, with `tests_lightroom_history.rs` and `lightroom_fixture.rs`. | `93baba5a67` | 2026-11-27 @ 5973d956df | `d08f388ee` | +| #4608 | merged | deps: update candle to 0.11.1 to move zip past GHSA-m665-v7pm-7grj | ADOPT | - | The fork already avoids the critical zip 7 advisory: its vendored candle-core 0.9.2 uses zip 9 (`vendor/candle-core`). But the lockfile had zip 9.2.2, still under the two later zip advisories the PR names (GHSA-h5xf-qc2v-94w6, fixed 9.2.0; GHSA-fpwh-q2m5-vfm2, fixed 9.2.3). Taken: `cargo update -p zip` to 9.8.2 (adds constant_time_eq 0.6.2). The candle 0.11.1 bump itself is not taken; the vendored patch stays. | `76bcfaae45` | 2026-11-27 @ 5973d956df | `88a4038e0` | +| #4695 | merged | ui-egui, catalog: name the camera above the Edit header | LEARN | - | Edit panel shows a cleaned-up camera name (maker words dropped, maker not said twice). The edit panel is fork-owned ui-egui; the name cleanup in `crates/catalog/src/model.rs` would need its own home in the fork. A feature to port by hand if wanted. | `339b0d72e4` | 2026-11-27 @ 5973d956df | - | +| #4720 | merged | UI: export watermark Position is a 3x3 grid | ADOPT | - | The fork's Edit Watermarks dialog had the same single row of nine arrows (`choices`). Hand-ported as a 3 x 3 grid in `panels/dialogs.rs`, same widget ids, checked in a headless screenshot. | `94b2e94744` | 2026-11-27 @ 5973d956df | `5b0ec87be` | +| #4723 | merged | packaging(linux): support co-installable nightly packages | SKIP | - | Upstream's nightly packaging, signing and launcher (apps, workflows, assets); the fork has its own nightly channel and packaging. | `5a20f060c9` | 2026-11-27 @ 5973d956df | - | +| #4740 | merged | Use the shared nightly launcher template | SKIP | - | Upstream nightly Linux launcher scripts only. | `10c12418ac` | 2026-11-27 @ 5973d956df | - | +| #4749 | merged | Switch on supervised nightlies on the nightly-signer branch | SKIP | - | Upstream nightly signing workflows and policy only. | `564e85a522` | 2026-11-27 @ 5973d956df | - | +| #4752 | merged | Nightly: stop blocking a refused launch on macOS | SKIP | - | Fixes upstream's nightly launch-profile refusal dialog (#4723), which the fork does not have. | `e5aaa4cffe` | 2026-11-27 @ 5973d956df | - | +| #4811 | merged | SAM 3: reduce DX12 attention pipeline startup time | SKIP | - | Smaller attention tiles in upstream's `crates/gpu` SAM 3 kernels; the fork has no SAM 3 GPU path (the #2533-#2537 stack is SKIP). | `d0a13f3587` | 2026-11-27 @ 5973d956df | - | +| #4816 | merged | LRC-LIB-LIBFOLDERS: a library path that differs only in letter case is the library's | ADOPT | - | The fork had the relink half of the bug: on a case-insensitive volume, folder.rename / folder.move given the library path in other letter case moved the folder but relinked none of its photos (reproduced on Windows: relinked 0). Fixed in the fork's own way: such a path is respelled to the library's spelling when it differs in letter case alone and is the same folder on disk. Upstream's link refusal is not taken (the fork compares protected folders on disk already). | `078971ed08` | 2026-11-27 @ 5973d956df | `c73d05733` | | craft-libs#2380 | merged | craft-raw: ORF crop coordinates never narrow | ADOPT | - | The fork had the same `v as usize` on LONG8 maker-note crop tags (a wrapped value passed as a plausible crop on wasm32); try_from plus subtraction bounds, preview casts too, test. | `58b06868e3` | 2026-11-25 @ 05b99ee5dc | 591961098 | | craft-libs#2379 | merged | craft-raw: ORF preview fallback | SKIP | - | The fork already scans an ORF for an unreferenced JPEG (RawFormat::is_supported leaves Orf out, preview.rs). | `9e81d13691` | 2026-11-25 @ 05b99ee5dc | - | | craft-libs#2378 | merged | craft-raw: NEF packed-layout guard | SKIP | - | Clippy-lint rewrite of the same logic; the fork's packed_layout reads differently and doesn't hit the lint. | `63124081c9` | 2026-11-25 @ 05b99ee5dc | - | @@ -1132,3 +1145,4 @@ PR head or commit SHA. A pipe inside a cell is escaped with a backslash. | round 11 (craft-libs lane opened) | 2026-11-25 | `ddc0eef377` (craft-libs `05b99ee5dc`) | upstream: 59 waiting rows moved (drift; 16 merge-only, decision changes recorded); craft-libs: 72 merged PRs/commits on tracked decoder and metadata paths since 2026-11-11, 30 fix PRs and named rows read in 3 batches | 9 craft-libs ports: #2380 `591961098`, #2232 `a00eaa8b0`, #1884 `29b1e4cff`, #1759 `2af1fbb33`, #1300 `741454ec5` (two parts), #1080 `4ece6fa6b`, #967 `9b501b761` (two parts), #1042 `e74a1b8a0` (one part), #2042 `1544fb16a` | craft-libs PENDING: #1314, #1745/#3050, #733, #534 (rev bump); LEARN #3042; upstream LEARN #4057 #4243 #4413 | upstream intake 2026-11-25 | | round 11 (#2661 settled) | 2026-11-25 | `ea033fbe1c` | 1: the carried PENDING row #2661, re-read in full (squash commit, PR reviews and threads) | 1 part: Boost `0e45c1889` onto the fork's depth-based Lens Blur | #2661 now LEARN: its full port (fork PR #1500) duplicated fork PR #1498 and was closed; brush refinement and per-mask Lens Blur ported after it onto the depth renderer; #4349 (Lens Blur on iPhone Portrait depth) stays PENDING | upstream intake 2026-11-25 | | monitor 2026-11-27 | 2026-11-27 | `5973d956df` (craft-libs `0ebc5915b0`) | upstream: 8 of 148 waiting rows moved (6 merged, 2 heads moved by main merges only); craft-libs: 0 of 5 waiting rows moved, 11 PRs on tracked paths since 2026-11-25, 2 merged (#3536 next into main: test sizing, a craft-cms split the fork does not use; #3578 jpeg-encoder 0.7, already in the fork), the rest open drafts, refactors or features: SKIP unlisted | 1: #2896 remainder `d21affb32` | #2378 WATCH; #3141, #3943, #1958 PENDING though merged upstream; #2584 SKIP; #2822, #3429 PENDING | upstream intake 2026-11-27 | +| monitor 2026-11-27 (unlogged merges) | 2026-11-27 | `5973d956df` | 13 PRs merged upstream since 2026-11-25 that had no ledger row (most from the 2026-11-26 backlog merge) | 3: #4816 fork fix `c73d05733`, #4608 zip lockfile bump `88a4038e0`, #4720 watermark grid `5b0ec87be` | LEARN #1900 #2194 #4695; SKIP #2018 #2838 (already in the fork) #4723 #4740 #4749 #4752 #4811 | upstream intake 2026-11-27 | diff --git a/docs/whats-new/2026-11-27-folder-rename-letter-case.md b/docs/whats-new/2026-11-27-folder-rename-letter-case.md new file mode 100644 index 0000000000..93dd212d81 --- /dev/null +++ b/docs/whats-new/2026-11-27-folder-rename-letter-case.md @@ -0,0 +1,2 @@ +### Renaming a library folder spelled in other letter case +- On Windows and macOS, renaming or moving a folder inside the library now keeps its photos linked when the path is typed with different letter case (for example through the command line or an agent); before, the folder moved on disk but its photos were left pointing at the old place. diff --git a/docs/whats-new/2026-11-27-watermark-position-grid.md b/docs/whats-new/2026-11-27-watermark-position-grid.md new file mode 100644 index 0000000000..b8808e8812 --- /dev/null +++ b/docs/whats-new/2026-11-27-watermark-position-grid.md @@ -0,0 +1,2 @@ +### Watermark position grid +- In Edit Watermarks, the nine Position buttons are now a 3 × 3 grid laid out like the corners, edges and centre they pick, instead of one long row of arrows.