diff --git a/src/backend/model/threading/MetadataLoader.ts b/src/backend/model/threading/MetadataLoader.ts index dd089a81..e95b734a 100644 --- a/src/backend/model/threading/MetadataLoader.ts +++ b/src/backend/model/threading/MetadataLoader.ts @@ -142,7 +142,8 @@ export class MetadataLoader { } if (exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate) { - metadata.creationDate = (exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate) * 1000; + metadata.creationDate = (exif.tags.DateTimeOriginal || exif.tags.CreateDate || exif.tags.ModifyDate) * 1000; + } if (exif.tags.Orientation) { diff --git a/test/backend/assets/date_issue.jpg b/test/backend/assets/date_issue.jpg new file mode 100644 index 00000000..c605d097 Binary files /dev/null and b/test/backend/assets/date_issue.jpg differ diff --git a/test/backend/assets/date_issue.json b/test/backend/assets/date_issue.json new file mode 100644 index 00000000..7a71dfdc --- /dev/null +++ b/test/backend/assets/date_issue.json @@ -0,0 +1,17 @@ +{ + "cameraData": { + "ISO": 500, + "exposure": 0.03333333333333333, + "fStop": 2, + "focalLength": 2.96, + "make": "HUAWEI", + "model": "HUAWEI G6-L11" + }, + "creationDate": 1460826466000, + "fileSize": 1980, + "orientation": 1, + "size": { + "height": 1, + "width": 1 + } +} diff --git a/test/backend/unit/model/threading/DiskMangerWorker.spec.ts b/test/backend/unit/model/threading/DiskMangerWorker.spec.ts index ed3544eb..cc245dc5 100644 --- a/test/backend/unit/model/threading/DiskMangerWorker.spec.ts +++ b/test/backend/unit/model/threading/DiskMangerWorker.spec.ts @@ -11,10 +11,10 @@ describe('DiskMangerWorker', () => { Config.Server.Media.folder = path.join(__dirname, '/../../../assets'); ProjectPath.ImageFolder = path.join(__dirname, '/../../../assets'); const dir = await DiskMangerWorker.scanDirectory('/'); - expect(dir.media.length).to.be.equals(4); + expect(dir.media.length).to.be.equals(5); const expected = require(path.join(__dirname, '/../../../assets/test image öüóőúéáű-.,.json')); - expect(Utils.clone(dir.media[1].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg'); - expect(Utils.clone(dir.media[1].metadata)).to.be.deep.equal(expected); + expect(Utils.clone(dir.media[2].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg'); + expect(Utils.clone(dir.media[2].metadata)).to.be.deep.equal(expected); }); }); diff --git a/test/backend/unit/model/threading/MetaDataLoader.spec.ts b/test/backend/unit/model/threading/MetaDataLoader.spec.ts index 18844107..8687e878 100644 --- a/test/backend/unit/model/threading/MetaDataLoader.spec.ts +++ b/test/backend/unit/model/threading/MetaDataLoader.spec.ts @@ -24,6 +24,12 @@ describe('MetadataLoader', () => { expect(Utils.clone(data)).to.be.deep.equal(expected); }); + it('should load miss dated jpg', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/date_issue.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/date_issue.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + it('should load jpg 2', async () => { const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/old_photo.jpg'));