diff --git a/frontend/src/components/duplicates/DuplicatesView.tsx b/frontend/src/components/duplicates/DuplicatesView.tsx index 4d3264f..c65ef44 100644 --- a/frontend/src/components/duplicates/DuplicatesView.tsx +++ b/frontend/src/components/duplicates/DuplicatesView.tsx @@ -515,20 +515,25 @@ function formatBytes(n: number): string { } /** Short label for the bottom path strip on a duplicate thumbnail. - * Goal: tell two copies-with-the-same-filename apart at a glance, so - * we want the parent folder name — that's almost always the - * discriminator (different shoots, different years, different - * upload sources). When the parent folder is unhelpful (e.g. the - * filename is itself sitting at the root) we fall back to the file - * basename. Long folder names get text-overflow-ellipsis'd by the - * enclosing strip's `truncate`. */ + * Goal: tell two copies-with-the-same-filename apart at a glance. + * Shows the last two folders ("…//") so the + * discriminator is visible even when both copies live under the + * same parent name (e.g. matching `2023` subfolders under different + * archives). The leading "…/" is always present when there's any + * truncated prefix; the enclosing strip's `truncate` handles any + * excess width. */ function duplicatePathLabel(filepath: string): string { if (!filepath) return '' const parts = filepath.split('/').filter(Boolean) if (parts.length === 0) return filepath - if (parts.length === 1) return parts[0] - // The second-to-last segment IS the parent directory. - return parts[parts.length - 2] + // Strip the filename (last segment); only the directory chain + // discriminates between copies with matching basenames. + const folders = parts.slice(0, -1) + if (folders.length === 0) return parts[0] + if (folders.length === 1) return `…/${folders[0]}` + const parent = folders[folders.length - 1] + const grandparent = folders[folders.length - 2] + return `…/${grandparent}/${parent}` } /** Adapt a DuplicateGroupMember (the slim API shape) to a Photo, which