Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d809019
upstream #3728: preview disk cache reads only regular files up to 64 MB
emmertex Nov 8, 2026
5f8ed4b
upstream #3185: folder walks and auto-import skip entries with the Wi…
emmertex Nov 8, 2026
ee52244
upstream #3137: Reload from Disk replaces a file-date capture-time gu…
emmertex Nov 8, 2026
bcf39e8
upstream #2757: keyword.delete takes several keywords as one undo step
emmertex Nov 8, 2026
ac2fcce
Upstream port k: ledger rows for #3728, #3185, #3137, #2757, #3654, #…
emmertex Nov 8, 2026
32cde93
upstream #1674: icon buttons show the pointing hand and a full hover …
emmertex Nov 8, 2026
27bb90b
upstream #1458: H toggles mask pins while Masking is open
emmertex Nov 8, 2026
9a86f46
upstream #3663: right-click > Delete Control Point on the point curve
emmertex Nov 8, 2026
61c3ee2
upstream #2756: Option/Alt-click on a sidebar triangle opens or folds…
emmertex Nov 8, 2026
e45abd4
upstream #3659: Survey filmstrip size slider
emmertex Nov 8, 2026
4d17b25
upstream #3687: Finnish translation gaps (keys the fork shares)
emmertex Nov 8, 2026
02d4dcd
Upstream intake: ledger rows for the hand ports #1458 #1674 #3663 #27…
emmertex Nov 8, 2026
c0c67b3
upstream #1639: Survey filmstrip clicks keep the surveyed group
emmertex Nov 8, 2026
b477ad8
upstream #2287: adjustable crop-mask opacity (Off/20/50/60/80/100 %, …
emmertex Nov 8, 2026
7cba545
upstream #2373: Reduce motion setting stops zoom glide, widget easing…
emmertex Nov 8, 2026
d22856b
upstream #3105: size-limit note and tight-limit warning in Export
emmertex Nov 8, 2026
71403d4
upstream #3692: rating and label keys are remappable commands; AZERTY…
emmertex Nov 8, 2026
715161c
upstream #2828: reorder smart-album rules and groups with the arrow keys
emmertex Nov 8, 2026
3613fef
upstream #3688: every rating, flag and label change confirms with a t…
emmertex Nov 8, 2026
7a20fee
Upstream port I: ledger rows for #2287 #2373 #2828 #3105 #3688 #3692 …
emmertex Nov 8, 2026
5960a20
upstream #3716: Compare/Survey right-click activates; menu rating row…
emmertex Nov 8, 2026
d47caf9
Upstream intake: ledger rows for #1639, #3716, #3461, #2806, #3332
emmertex Nov 8, 2026
b672602
Merge branch 'upstream-port-i' into upstream-intake-2026-11-08-b4code
emmertex Nov 8, 2026
c85998a
Upstream intake 2026-11-08 bundle 4: dedupe ledger rows
emmertex Nov 8, 2026
0f71d8f
Upstream intake 2026-11-08 bundle 4: resolve the shortcuts and parity…
emmertex Nov 8, 2026
2a79150
Merge branch 'upstream-port-k' into upstream-intake-2026-11-08-b4code
emmertex Nov 8, 2026
e99f3ec
Upstream intake 2026-11-08 bundle 4: clippy (unwrap_or_else)
emmertex Nov 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions crates/catalog/src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ impl Catalog {
Ok(Op::Batch { ops })
}

/// Remove several keywords (each with the keywords below it) from every photo and from the keyword list as one
/// batch (upstream #2757). Nothing is removed when one is empty or none is named.
pub fn delete_keywords_ops(&self, keywords: &[String]) -> Result<Op> {
let ks: Vec<String> = keywords.iter().map(|k| clean(k)).collect();
if ks.is_empty() || ks.iter().any(String::is_empty) {
return Err(CatalogError::Invalid("empty keyword".into()));
}
let under_any = |x: &str| ks.iter().any(|k| is_under(x, k));
let mut ops = self.keyword_ops(|kws| kws.iter().filter(|x| !under_any(x)).cloned().collect());
ops.extend(self.list_ops(|list| list.retain(|_, l| !under_any(&l.path))));
Ok(Op::Batch { ops })
}

/// Merge several keywords (with their children) into `into`.
pub fn merge_keywords_ops(&self, from: &[String], into: &str) -> Result<Op> {
let into = clean(into);
Expand Down
24 changes: 23 additions & 1 deletion crates/engine/src/cmd/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ fn fill_missing_meta(id: lcc_catalog::PhotoId, ph: &lcc_catalog::Photo, info: &c
if m != before {
ops.push(Op::SetMeta { id, meta: Box::new(m) });
}
if ph.captured.is_none() && info.captured.is_some() {
// a time the photo has only as import's file-date guess ([`lcc_catalog::Photo::captured_fallback`]) gives way to the
// capture time the file states now (written by an editor after import); a stated or edited time is kept
// (upstream #3137, without its catalog field)
let guess = ph.captured.is_some() && ph.captured_stated().is_none();
if (ph.captured.is_none() || guess) && info.captured.is_some() && info.captured != ph.captured {
ops.push(Op::SetCaptured { id, captured: info.captured.clone() });
}
ops
Expand Down Expand Up @@ -480,6 +484,24 @@ mod tests {
use super::*;
use lcc_catalog::{Photo, PhotoId, Source};

/// Reload replaces the file-date guess with the capture time the file states now, and keeps a stated one.
#[test]
fn reload_replaces_a_file_date_guess_but_not_a_stated_time() {
let mut ph = Photo::new(PhotoId(1), Source::File { path: "/x.jpg".into() }, "x.jpg", "jpeg", 40, 30, "2026-10-06T00:00:00");
ph.captured = Some("2026-01-01T10:00:00".into());
ph.captured_fallback = ph.captured.clone();
let mut info = crate::media::ProbeInfo { captured: Some("2025-05-05T08:30:00".into()), ..Default::default() };
let ops = fill_missing_meta(PhotoId(1), &ph, &info);
assert!(matches!(ops.as_slice(), [Op::SetCaptured { captured: Some(c), .. }] if c == "2025-05-05T08:30:00"), "{ops:?}");
// a time that was stated (or edited by hand) stays
ph.captured_fallback = None;
assert!(fill_missing_meta(PhotoId(1), &ph, &info).is_empty());
// no stated time in the file now: the guess stays
ph.captured_fallback = ph.captured.clone();
info.captured = None;
assert!(fill_missing_meta(PhotoId(1), &ph, &info).is_empty());
}

/// A catalog from before Make and Model were kept separately gets its parts backfilled and its
/// label re-derived ("Canon Canon IXUS 185" → "Canon IXUS 185") on reload (upstream #1618).
#[test]
Expand Down
8 changes: 7 additions & 1 deletion crates/engine/src/cmd/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,15 @@ pub fn specs() -> Vec<CommandSpec> {
"Delete Keyword",
[],
None,
"{keyword} — removes it (and the keywords below it) from every photo",
"{keyword} — removes it (and the keywords below it) from every photo. Several at once: {keywords: [keyword]}, still one undo step; an empty one refuses the whole call",
always,
|s, p| {
if p.get("keywords").is_some_and(|v| !v.is_null()) {
let ks = strs(p, "keywords");
let op = s.catalog.delete_keywords_ops(&ks).map_err(|e| bad("keyword.delete", e.to_string()))?;
let cleaned: Vec<String> = ks.iter().map(|k| clean(k)).collect();
return commit_keywords(s, "Delete Keywords", op, |f| (!cleaned.iter().any(|c| is_under(f, c))).then(|| f.to_string()));
}
let k = str_param(p, "keyword").ok_or_else(|| bad("keyword.delete", "missing `keyword`"))?.to_string();
let op = s.catalog.delete_keyword_ops(&k).map_err(|e| bad("keyword.delete", e.to_string()))?;
let c = clean(&k);
Expand Down
10 changes: 7 additions & 3 deletions crates/engine/src/cmd/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ pub fn list_auto_import_folder(folder: &str) -> std::result::Result<Vec<(String,
let rd = std::fs::read_dir(folder).map_err(|e| format!("{folder}: {e}"))?;
Ok(rd
.flatten()
.filter(|e| !e.file_name().to_string_lossy().starts_with('.'))
.filter_map(|e| {
let m = std::fs::metadata(e.path()).ok()?;
m.is_file().then(|| (e.path().to_string_lossy().to_string(), m.len()))
let path = e.path();
// through a link: its target's type and size
let m = std::fs::metadata(&path).ok()?;
// but a link's own hidden attribute, not its target's, as in a folder walk
let hidden =
if e.file_type().is_ok_and(|t| t.is_symlink()) { crate::walk::is_hidden_entry(&e) } else { crate::walk::is_hidden_with(&path, &m) };
(m.is_file() && !hidden).then(|| (path.to_string_lossy().to_string(), m.len()))
})
.collect())
}
Expand Down
24 changes: 24 additions & 0 deletions crates/engine/src/tests_libops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,30 @@ fn keyword_rename_merge_delete_undo_and_replay() {
let _ = std::fs::remove_dir_all(&dir);
}

/// `keyword.delete {keywords}` removes several keywords (and what is below them) as one undo step, and refuses the
/// whole call when one is empty (upstream #2757).
#[test]
fn several_keywords_are_deleted_as_one_undo_step() {
let dir = temp_dir("kw-batch");
let mut s = Session::new();
s.open_library(&dir, true).unwrap();
let ids: Vec<u64> = s.visible_cloned().iter().take(2).map(|p| p.0).collect();
s.execute("photo.setMeta", &json!({"ids": [ids[0]], "keywords": ["travel|italy", "sea", "keep"]})).unwrap();
s.execute("photo.setMeta", &json!({"ids": [ids[1]], "keywords": ["sea", "city"]})).unwrap();
let before = s.catalog.to_snapshot();
assert!(s.execute("keyword.delete", &json!({"keywords": ["sea", ""]})).is_err());
assert!(s.execute("keyword.delete", &json!({"keywords": []})).is_err());
assert_eq!(s.catalog.to_snapshot(), before, "a refused call changes nothing");
let undo_before = s.undo.len();
s.execute("keyword.delete", &json!({"keywords": ["travel", "sea"]})).unwrap();
assert_eq!(s.undo.len(), undo_before + 1, "one undo step");
assert_eq!(keywords_of(&s, ids[0]), ["keep"]);
assert_eq!(keywords_of(&s, ids[1]), ["city"]);
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(s.catalog.to_snapshot(), before);
let _ = std::fs::remove_dir_all(&dir);
}

fn write_png(path: &std::path::Path, seed: u8) {
let (w, h) = (24usize, 16usize);
let data: Vec<[u8; 4]> = (0..w * h).map(|i| [(i % w * 9) as u8, (i / w * 11) as u8, seed, 255]).collect();
Expand Down
106 changes: 104 additions & 2 deletions crates/engine/src/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,75 @@ fn hidden(p: &Path) -> bool {
p.file_name().is_some_and(|n| n.to_string_lossy().starts_with('.'))
}

/// A platform's hidden attribute: the bit of an entry's attribute word that hides it (upstream #3185).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
struct HiddenAttribute {
bit: u32,
/// Whether a folder's listing already holds every entry's attribute word (Windows). Where it does not (macOS:
/// one lstat per entry, a round trip each on a network share), the attribute of a listed entry is read only for
/// folders and links: a hidden folder (`~/Library`) hides a whole tree, while a file hidden other than by a dot
/// name is a rare system file, not a photo.
listed: bool,
}

impl HiddenAttribute {
fn hides(self, word: u32) -> bool {
word & self.bit != 0
}

/// Whether a listed entry's attribute word is read at all.
fn read_for(self, may_hold_a_tree: bool) -> bool {
may_hold_a_tree || self.listed
}
}

/// `FILE_ATTRIBUTE_HIDDEN`, which comes with the listing.
const WINDOWS_HIDDEN: HiddenAttribute = HiddenAttribute { bit: 0x2, listed: true };
/// `UF_HIDDEN` (Finder's hidden flag) in `st_flags`, which takes an lstat.
const MACOS_HIDDEN: HiddenAttribute = HiddenAttribute { bit: 0x8000, listed: false };
/// This platform's hidden attribute (none elsewhere: only dot names are hidden).
const HIDDEN: Option<HiddenAttribute> = if cfg!(windows) {
Some(WINDOWS_HIDDEN)
} else if cfg!(target_os = "macos") {
Some(MACOS_HIDDEN)
} else {
None
};

/// The word [`HIDDEN`]'s bit is in.
fn attribute_word(m: &std::fs::Metadata) -> u32 {
#[cfg(windows)]
{
use std::os::windows::fs::MetadataExt;
m.file_attributes()
}
#[cfg(target_os = "macos")]
{
use std::os::darwin::fs::MetadataExt;
m.st_flags()
}
#[cfg(not(any(windows, target_os = "macos")))]
{
let _ = m;
0
}
}

/// Whether a listed entry is hidden: a dot-prefixed name, or the Windows or macOS hidden attribute (on macOS read for
/// folders and links only, see [`HiddenAttribute`]; a link's own attribute, not its target's).
pub fn is_hidden_entry(entry: &std::fs::DirEntry) -> bool {
hidden(&entry.path()) || entry.file_type().is_ok_and(|t| attribute_hides_entry(entry, &t))
}

fn attribute_hides_entry(entry: &std::fs::DirEntry, ft: &std::fs::FileType) -> bool {
HIDDEN.is_some_and(|a| a.read_for(ft.is_dir() || ft.is_symlink()) && entry.metadata().is_ok_and(|m| a.hides(attribute_word(&m))))
}

/// Whether `path`, whose `metadata` the caller has already read, is hidden (name or attribute).
pub fn is_hidden_with(path: &Path, metadata: &std::fs::Metadata) -> bool {
hidden(path) || HIDDEN.is_some_and(|a| a.hides(attribute_word(metadata)))
}

/// What a folder's listing says an entry is.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EntryKind {
Expand Down Expand Up @@ -153,11 +222,11 @@ fn walk(
let p = e.path();
// (a hidden entry's kind is only asked for when the listing is wanted; every other
// entry's is asked once)
let is_hidden = hidden(&p);
let ft = e.file_type();
let is_hidden = hidden(&p) || ft.as_ref().is_ok_and(|t| attribute_hides_entry(&e, t));
if is_hidden && listed.is_none() {
continue;
}
let ft = e.file_type();
if let Some(listed) = listed.as_mut() {
let kind = match &ft {
Ok(t) if t.is_symlink() => EntryKind::Other,
Expand Down Expand Up @@ -214,6 +283,39 @@ fn walk(
mod tests {
use super::*;

#[test]
fn hidden_attribute_bits_and_which_entries_are_read() {
// (the platform words are stubbed: the logic is the same where the attribute exists)
assert!(MACOS_HIDDEN.hides(0x8000 | 0x1));
assert!(!MACOS_HIDDEN.hides(0x1));
assert!(WINDOWS_HIDDEN.hides(0x2 | 0x20));
assert!(!WINDOWS_HIDDEN.hides(0x20));
// macOS reads the attribute (an lstat each) for folders and links only; Windows has it from the listing
assert!(MACOS_HIDDEN.read_for(true) && !MACOS_HIDDEN.read_for(false));
assert!(WINDOWS_HIDDEN.read_for(true) && WINDOWS_HIDDEN.read_for(false));
}

#[test]
fn auto_import_listing_skips_dot_files_and_lists_links_by_target() {
let dir = std::env::temp_dir().join(format!("lcc-walk-hidden-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(dir.join("folder")).unwrap();
std::fs::write(dir.join("shown.jpg"), b"shown").unwrap();
std::fs::write(dir.join(".dot.jpg"), b"x").unwrap();
#[cfg(unix)]
std::os::unix::fs::symlink(dir.join("shown.jpg"), dir.join("link.jpg")).unwrap();
let mut listed = crate::cmd::library::list_auto_import_folder(&dir.to_string_lossy()).unwrap();
listed.sort();
let entry = |name: &str, size: u64| (dir.join(name).to_string_lossy().to_string(), size);
let mut expected = vec![entry("shown.jpg", 5)];
if cfg!(unix) {
expected.push(entry("link.jpg", 5));
}
expected.sort();
assert_eq!(listed, expected);
let _ = std::fs::remove_dir_all(&dir);
}

fn tmp(tag: &str) -> PathBuf {
let d = std::env::temp_dir().join(format!("lc-walk-{tag}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&d);
Expand Down
27 changes: 23 additions & 4 deletions crates/preview/src/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@ fn write_fresh(path: &Path, bytes: &[u8]) -> std::io::Result<()> {
std::fs::OpenOptions::new().write(true).create_new(true).open(path)?.write_all(bytes)
}

/// Most bytes of one cache entry read into memory (a thumbnail is a few hundred KB).
const MAX_ENTRY_BYTES: u64 = 64 << 20;

/// The entry at `path`: the OPENED file must be a regular file within [`MAX_ENTRY_BYTES`], so a link planted in
/// the cache to an endless source or a FIFO is not read to its end (upstream #3728).
fn read_regular(path: &Path) -> std::io::Result<Vec<u8>> {
use std::io::Read;
let f = std::fs::File::open(path)?;
if !f.metadata()?.is_file() {
return Err(std::io::Error::new(std::io::ErrorKind::InvalidInput, "not a regular file"));
}
let mut b = Vec::new();
f.take(MAX_ENTRY_BYTES.saturating_add(1)).read_to_end(&mut b)?;
if u64::try_from(b.len()).is_ok_and(|n| n > MAX_ENTRY_BYTES) {
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "cache entry too large"));
}
Ok(b)
}

pub struct DiskCache {
dir: PathBuf,
/// Bytes the cache may hold (changed in place by [`DiskCache::set_budget`]).
Expand Down Expand Up @@ -173,13 +192,13 @@ impl DiskCache {
if !p.parent().is_some_and(is_real_dir) {
return None;
}
if let Ok(bytes) = std::fs::read(&p) {
if let Ok(bytes) = read_regular(&p) {
return Some((p, bytes));
}
let old = self.named(key, OLD_EXT);
let Ok(bytes) = std::fs::read(&old) else {
let Ok(bytes) = read_regular(&old) else {
// (taken over by the tidying between the two looks: it is under the new name now)
return std::fs::read(&p).ok().map(|bytes| (p, bytes));
return read_regular(&p).ok().map(|bytes| (p, bytes));
};
// (taken over; if that can't be done it is read where it is, and tried again next time)
match std::fs::rename(&old, &p) {
Expand Down Expand Up @@ -250,7 +269,7 @@ impl DiskCache {
if !p.parent().is_some_and(is_real_dir) {
return None;
}
let Ok(bytes) = std::fs::read(&p) else {
let Ok(bytes) = read_regular(&p) else {
self.misses.fetch_add(1, Ordering::Relaxed);
return None;
};
Expand Down
15 changes: 15 additions & 0 deletions crates/preview/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,3 +1201,18 @@ fn a_full_cache_prunes_the_pictures_kept_last_after_everything_else() {
assert!(others <= 3, "the others went first: {others} of 9 left");
let _ = std::fs::remove_dir_all(dir);
}

/// An entry that is not a regular file (a directory here; a FIFO or an endless device on Unix) is a miss, never read
/// (upstream #3728).
#[test]
fn disk_cache_entry_that_is_not_a_regular_file_is_a_miss() {
let dir = temp_dir("non-regular");
let key = hash_bytes(&[4, 2]);
let hex = key.to_string();
let shard = dir.join(&hex[..2]);
std::fs::create_dir_all(shard.join(format!("{hex}.{}", disk::EXT))).unwrap();
let d = DiskCache::new(&dir, 1 << 20);
assert!(d.get(key).is_none());
assert!(d.get_data(key).is_none());
let _ = std::fs::remove_dir_all(&dir);
}
2 changes: 2 additions & 0 deletions crates/ui-egui/locales/fork/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Copying picked files": "Kopírování vybraných souborů",
"Copyright & Contact": "Autorská práva a kontakt",
"Cut Guides": "Vodítka pro řez",
"Delete Control Point": "Smazat řídicí bod",
"Develop without Import": "Vyvíjet bez importu",
"Device storage": "Úložiště zařízení",
"Dismiss Message": "Zavřít zprávu",
Expand Down Expand Up @@ -81,6 +82,7 @@
"File format, colour space and bit depth: Settings → External Editing.": "Formát souboru, barevný prostor a bitová hloubka: Nastavení → Externí úpravy.",
"Filling spots": "Vyplňování bodů",
"Film recipe": "Filmový recept",
"Filmstrip size": "Velikost filmového pásu",
"Filters": "Filtry",
"Finer detail and edges, less false colour, at the same size.": "Jemnější detaily a hrany, méně falešných barev, ve stejné velikosti.",
"Finer detail from the AI upscaler at the same size, as a new TIFF.": "Jemnější detaily od zvětšovače AI ve stejné velikosti jako nový TIFF.",
Expand Down
2 changes: 2 additions & 0 deletions crates/ui-egui/locales/fork/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@
"Decrease Thumbnail Size": "Miniaturen verkleinern",
"Default": "Standard",
"Default: the session name": "Standard: der Sitzungsname",
"Delete Control Point": "Kontrollpunkt löschen",
"Delete Empty Folder": "Leeren Ordner löschen",
"Delete File Naming Preset": "Dateibenennungsvorgabe löschen",
"Delete Import Preset": "Importvorgabe löschen",
Expand Down Expand Up @@ -576,6 +577,7 @@
"Fills Sublocation, City, State and Country from GPS. Off until you choose a provider.": "Füllt Ortsdetail, Stadt, Bundesland und Land aus GPS. Aus, bis Sie einen Anbieter wählen.",
"Fills made earlier for this photo, not on it now:": "Früher für dieses Foto erstellte Füllungen, die jetzt nicht darauf sind:",
"Film recipe": "Filmrezept",
"Filmstrip size": "Filmstreifengröße",
"Filters": "Filter",
"Find": "Suchen",
"Find Again": "Erneut suchen",
Expand Down
2 changes: 2 additions & 0 deletions crates/ui-egui/locales/fork/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@
"Decrease Thumbnail Size": "Reducir tamaño de miniaturas",
"Default": "Predeterminada",
"Default: the session name": "Predeterminado: el nombre de la sesión",
"Delete Control Point": "Eliminar punto de control",
"Delete Empty Folder": "Eliminar carpeta vacía",
"Delete File Naming Preset": "Eliminar ajuste preestablecido de nombres de archivo",
"Delete Import Preset": "Eliminar ajuste de importación",
Expand Down Expand Up @@ -607,6 +608,7 @@
"Fills Sublocation, City, State and Country from GPS. Off until you choose a provider.": "Rellena sublocalización, ciudad, estado y país a partir del GPS. Desactivado hasta que elijas un proveedor.",
"Fills made earlier for this photo, not on it now:": "Rellenos hechos antes para esta foto que ahora no están en ella:",
"Film recipe": "Receta de película",
"Filmstrip size": "Tamaño de la tira de película",
"Filters": "Filtros",
"Find": "Buscar",
"Find Again": "Buscar de nuevo",
Expand Down
Loading