diff --git a/web/src/lib/services/adapters/duplicates.ts b/web/src/lib/services/adapters/duplicates.ts index 8ba63fa..f5cc9f6 100644 --- a/web/src/lib/services/adapters/duplicates.ts +++ b/web/src/lib/services/adapters/duplicates.ts @@ -25,23 +25,18 @@ export interface DuplicateGroup { } export async function listDuplicateGroups(basePath?: string): Promise { + // Build query: stack:true + optional path filter + const pathFilter = basePath ? ` path:${basePath}*` : ''; + const q = `stack:true${pathFilter}`; + const photos = await listPhotos({ - q: 'stack:true', + q, count: 200, merged: true, order: 'newest' }); return photos - .filter((p) => { - // Filter out photos not in the current user's base path - if (basePath) { - const photoPath = p.Path ?? ''; - if (!photoPath.startsWith(basePath)) { - return false; - } - } - return (p.Files?.length ?? 0) > 1; - }) + .filter((p) => (p.Files?.length ?? 0) > 1) .map((p) => { const files = p.Files ?? []; const primary = files.find((f) => f.Primary) ?? files[0];