Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(exif): 提取 EXIF IPTC/XMP 关键词时进行去重

Timothy Yin0cb07feffe16
diff --git a/server/services/image/exif.ts b/server/services/image/exif.ts
index 7cf0b5d9..e854c9ee 100644
--- a/server/services/image/exif.ts
+++ b/server/services/image/exif.ts
@@ -170,7 +170,11 @@ export const extractPhotoInfo = (
const dirPath = path.dirname(s3key)
if (exifData?.Subject || exifData?.Keywords) {
- tags = [...(exifData.Subject || []), ...(exifData.Keywords || [])]
+ tags = [
+ ...new Set([...(exifData.Subject || []), ...(exifData.Keywords || [])]),
+ ]
+ .map((tag) => tag.trim())
+ .filter((tag) => tag.length > 0)
} else if (dirPath && dirPath !== '.' && dirPath !== '/') {
let relativePath = dirPath
relativePath = dirPath.slice('/photos'.length)