1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-26 10:50:29 +02:00

fix(server): empty tag responses should be considered valid (#2993)

* accept empty tag array

* renamed test
This commit is contained in:
Mert 2023-06-28 10:40:30 -04:00 committed by GitHub
parent 22a73b67d3
commit 017214fd56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -91,13 +91,13 @@ describe(SmartInfoService.name, () => {
}); });
}); });
it('should no update the smart info if no tags were returned', async () => { it('should always overwrite old tags', async () => {
machineMock.classifyImage.mockResolvedValue([]); machineMock.classifyImage.mockResolvedValue([]);
await sut.handleClassifyImage({ id: asset.id }); await sut.handleClassifyImage({ id: asset.id });
expect(machineMock.classifyImage).toHaveBeenCalled(); expect(machineMock.classifyImage).toHaveBeenCalled();
expect(smartMock.upsert).not.toHaveBeenCalled(); expect(smartMock.upsert).toHaveBeenCalled();
}); });
}); });

View File

@ -41,10 +41,6 @@ export class SmartInfoService {
} }
const tags = await this.machineLearning.classifyImage({ imagePath: asset.resizePath }); const tags = await this.machineLearning.classifyImage({ imagePath: asset.resizePath });
if (tags.length === 0) {
return false;
}
await this.repository.upsert({ assetId: asset.id, tags }); await this.repository.upsert({ assetId: asset.id, tags });
return true; return true;