From 3a694219bfc292f57d9bb0d61aaab38b84505c8b Mon Sep 17 00:00:00 2001 From: Kevin Puertas Date: Wed, 19 Nov 2025 04:24:17 +0100 Subject: [PATCH] feat: add originalPath for external library assets in dedupe (#23710) * Add original path info row to duplicate asset component View path of images, useful when using external Library * Make if for not show path in internal images * Update web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> * Refactor original path display logic in duplicate-asset * Update duplicate-asset.svelte * Add full path localization string * Change translated data * format: fix --------- Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Co-authored-by: Alex Tran --- i18n/en.json | 1 + .../duplicates/duplicate-asset.svelte | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/i18n/en.json b/i18n/en.json index 2b69858f9a..4e3f274340 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1121,6 +1121,7 @@ "folders_feature_description": "Browsing the folder view for the photos and videos on the file system", "forgot_pin_code_question": "Forgot your PIN?", "forward": "Forward", + "full_path": "Full path: {path}", "gcast_enabled": "Google Cast", "gcast_enabled_description": "This feature loads external resources from Google in order to work.", "general": "General", diff --git a/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte b/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte index 8a8395d792..c0f5428c81 100644 --- a/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte +++ b/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte @@ -12,6 +12,7 @@ mdiClock, mdiFile, mdiFitToScreen, + mdiFolderOutline, mdiHeart, mdiImageMultipleOutline, mdiImageOutline, @@ -51,6 +52,7 @@ fileName: isDifferent((a) => a.originalFileName), fileSize: isDifferent((a) => getFileSize(a)), resolution: isDifferent((a) => getAssetResolution(a)), + originalPath: isDifferent((a) => a.originalPath ?? $t('unknown')), date: isDifferent((a) => { const tz = a.exifInfo?.timeZone; const dt = @@ -79,6 +81,24 @@ (a) => [a.exifInfo?.city, a.exifInfo?.state, a.exifInfo?.country].filter(Boolean).join(', ') || 'unknown', ), }); + + const getBasePath = (fullpath: string, fileName: string): string => { + if (fileName && fullpath.endsWith(fileName)) { + return fullpath.slice(0, -(fileName.length + 1)); + } + return fullpath; + }; + + function truncateMiddle(path: string, maxLength: number = 50): string { + if (path.length <= maxLength) { + return path; + } + + const start = Math.floor(maxLength / 2) - 2; + const end = Math.floor(maxLength / 2) - 2; + + return path.slice(0, Math.max(0, start)) + '...' + path.slice(Math.max(0, path.length - end)); + }
@@ -152,6 +172,14 @@ {asset.originalFileName} + + {truncateMiddle(getBasePath(asset.originalPath, asset.originalFileName)) || $t('unknown')} + + {getFileSize(asset)}