mirror of
https://github.com/immich-app/immich.git
synced 2024-11-24 08:52:28 +02:00
fix(server): handle multiple hierarchical subjects (#12509)
This commit is contained in:
parent
7b2f98a433
commit
b3ef5fe6e7
@ -453,7 +453,7 @@ describe(MetadataService.name, () => {
|
|||||||
|
|
||||||
it('should extract hierarchy from HierarchicalSubject', async () => {
|
it('should extract hierarchy from HierarchicalSubject', async () => {
|
||||||
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
||||||
metadataMock.readTags.mockResolvedValue({ HierarchicalSubject: ['Parent|Child'] });
|
metadataMock.readTags.mockResolvedValue({ HierarchicalSubject: ['Parent|Child', 'TagA'] });
|
||||||
tagMock.upsertValue.mockResolvedValueOnce(tagStub.parent);
|
tagMock.upsertValue.mockResolvedValueOnce(tagStub.parent);
|
||||||
tagMock.upsertValue.mockResolvedValueOnce(tagStub.child);
|
tagMock.upsertValue.mockResolvedValueOnce(tagStub.child);
|
||||||
|
|
||||||
@ -465,6 +465,7 @@ describe(MetadataService.name, () => {
|
|||||||
value: 'Parent/Child',
|
value: 'Parent/Child',
|
||||||
parent: tagStub.parent,
|
parent: tagStub.parent,
|
||||||
});
|
});
|
||||||
|
expect(tagMock.upsertValue).toHaveBeenNthCalledWith(3, { userId: 'user-id', value: 'TagA', parent: undefined });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should extract ignore / characters in a HierarchicalSubject tag', async () => {
|
it('should extract ignore / characters in a HierarchicalSubject tag', async () => {
|
||||||
|
@ -384,12 +384,12 @@ export class MetadataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async applyTagList(asset: AssetEntity, exifTags: ImmichTags) {
|
private async applyTagList(asset: AssetEntity, exifTags: ImmichTags) {
|
||||||
const tags: unknown[] = [];
|
const tags: Array<string | number> = [];
|
||||||
if (exifTags.TagsList) {
|
if (exifTags.TagsList) {
|
||||||
tags.push(...exifTags.TagsList);
|
tags.push(...exifTags.TagsList);
|
||||||
} else if (exifTags.HierarchicalSubject) {
|
} else if (exifTags.HierarchicalSubject) {
|
||||||
tags.push(
|
tags.push(
|
||||||
exifTags.HierarchicalSubject.map((tag) =>
|
...exifTags.HierarchicalSubject.map((tag) =>
|
||||||
tag
|
tag
|
||||||
// convert | to /
|
// convert | to /
|
||||||
.replaceAll('/', '<PLACEHOLDER>')
|
.replaceAll('/', '<PLACEHOLDER>')
|
||||||
|
Loading…
Reference in New Issue
Block a user