fix(server): exif description whitespace handling (#11249)
* fix(server): exif description whitespace handling * remove trim optional chaining
This commit is contained in:
@@ -710,6 +710,26 @@ describe(MetadataService.name, () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('trims whitespace from description', async () => {
|
||||
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
||||
metadataMock.readTags.mockResolvedValue({ Description: '\t \v \f \n \r' });
|
||||
|
||||
await sut.handleMetadataExtraction({ id: assetStub.image.id });
|
||||
expect(assetMock.upsertExif).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
description: '',
|
||||
}),
|
||||
);
|
||||
|
||||
metadataMock.readTags.mockResolvedValue({ ImageDescription: ' my\n description' });
|
||||
await sut.handleMetadataExtraction({ id: assetStub.image.id });
|
||||
expect(assetMock.upsertExif).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
description: 'my\n description',
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('handleQueueSidecar', () => {
|
||||
@@ -889,6 +909,7 @@ describe(MetadataService.name, () => {
|
||||
}),
|
||||
).resolves.toBe(JobStatus.SUCCESS);
|
||||
expect(metadataMock.writeTags).toHaveBeenCalledWith(assetStub.sidecar.sidecarPath, {
|
||||
Description: description,
|
||||
ImageDescription: description,
|
||||
CreationDate: date,
|
||||
GPSLatitude: gps,
|
||||
|
||||
Reference in New Issue
Block a user