Skip to content

High performance self-hosted photo and video management solution.

feat(server): prefer tagslist (#12286)

Jason Rasmussenddd73b9911e7
diff --git a/server/src/services/metadata.service.spec.ts b/server/src/services/metadata.service.spec.ts
index 3e3e5e0db1..84b67be5cd 100644
--- a/server/src/services/metadata.service.spec.ts
+++ b/server/src/services/metadata.service.spec.ts
@@ -434,6 +434,21 @@ describe(MetadataService.name, () => {
});
});
+ it('should ignore Keywords when TagsList is present', async () => {
+ assetMock.getByIds.mockResolvedValue([assetStub.image]);
+ metadataMock.readTags.mockResolvedValue({ Keywords: 'Child', TagsList: ['Parent/Child'] });
+ tagMock.upsertValue.mockResolvedValue(tagStub.parent);
+
+ await sut.handleMetadataExtraction({ id: assetStub.image.id });
+
+ expect(tagMock.upsertValue).toHaveBeenNthCalledWith(1, { userId: 'user-id', value: 'Parent', parent: undefined });
+ expect(tagMock.upsertValue).toHaveBeenNthCalledWith(2, {
+ userId: 'user-id',
+ value: 'Parent/Child',
+ parent: tagStub.parent,
+ });
+ });
+
it('should not apply motion photos if asset is video', async () => {
assetMock.getByIds.mockResolvedValue([{ ...assetStub.livePhotoMotionAsset, isVisible: true }]);
mediaMock.probe.mockResolvedValue(probeStub.matroskaContainer);
diff --git a/server/src/services/metadata.service.ts b/server/src/services/metadata.service.ts
index a0a8f9ebef..de3babb138 100644
--- a/server/src/services/metadata.service.ts
+++ b/server/src/services/metadata.service.ts
@@ -355,9 +355,7 @@ export class MetadataService {
const tags: unknown[] = [];
if (exifTags.TagsList) {
tags.push(...exifTags.TagsList);
- }
-
- if (exifTags.Keywords) {
+ } else if (exifTags.Keywords) {
let keywords = exifTags.Keywords;
if (!Array.isArray(keywords)) {
keywords = [keywords];