mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): use stat instead of exifinfo for file date metadata (#17311)
* use stat instead of filecreatedate * update tests * unused import
This commit is contained in:
parent
502854cee1
commit
d911b76c08
3 changed files with 92 additions and 75 deletions
|
|
@ -39,7 +39,12 @@ describe(MetadataService.name, () => {
|
|||
beforeEach(() => {
|
||||
({ sut, mocks } = newTestService(MetadataService, { metadata: metadataRepository }));
|
||||
|
||||
mocks.storage.stat.mockResolvedValue({ size: 123_456, ctime: new Date(), mtime: new Date() } as Stats);
|
||||
mocks.storage.stat.mockResolvedValue({
|
||||
size: 123_456,
|
||||
mtime: new Date(654_321),
|
||||
mtimeMs: 654_321,
|
||||
birthtimeMs: 654_322,
|
||||
} as Stats);
|
||||
|
||||
delete process.env.TZ;
|
||||
});
|
||||
|
|
@ -54,8 +59,6 @@ describe(MetadataService.name, () => {
|
|||
description: 'should handle no time zone information',
|
||||
exifData: {
|
||||
DateTimeOriginal: '2022:01:01 00:00:00',
|
||||
FileCreateDate: '2022:01:01 00:00:00',
|
||||
FileModifyDate: '2022:01:01 00:00:00',
|
||||
},
|
||||
expected: {
|
||||
localDateTime: '2022-01-01T00:00:00.000Z',
|
||||
|
|
@ -68,8 +71,6 @@ describe(MetadataService.name, () => {
|
|||
serverTimeZone: 'America/Los_Angeles',
|
||||
exifData: {
|
||||
DateTimeOriginal: '2022:01:01 00:00:00',
|
||||
FileCreateDate: '2022:01:01 00:00:00',
|
||||
FileModifyDate: '2022:01:01 00:00:00',
|
||||
},
|
||||
expected: {
|
||||
localDateTime: '2022-01-01T00:00:00.000Z',
|
||||
|
|
@ -82,8 +83,6 @@ describe(MetadataService.name, () => {
|
|||
serverTimeZone: 'Europe/Brussels',
|
||||
exifData: {
|
||||
DateTimeOriginal: '2022:01:01 00:00:00',
|
||||
FileCreateDate: '2022:01:01 00:00:00',
|
||||
FileModifyDate: '2022:01:01 00:00:00',
|
||||
},
|
||||
expected: {
|
||||
localDateTime: '2022-01-01T00:00:00.000Z',
|
||||
|
|
@ -96,8 +95,6 @@ describe(MetadataService.name, () => {
|
|||
serverTimeZone: 'Europe/Brussels',
|
||||
exifData: {
|
||||
DateTimeOriginal: '2022:06:01 00:00:00',
|
||||
FileCreateDate: '2022:06:01 00:00:00',
|
||||
FileModifyDate: '2022:06:01 00:00:00',
|
||||
},
|
||||
expected: {
|
||||
localDateTime: '2022-06-01T00:00:00.000Z',
|
||||
|
|
@ -109,8 +106,6 @@ describe(MetadataService.name, () => {
|
|||
description: 'should handle a +13:00 time zone',
|
||||
exifData: {
|
||||
DateTimeOriginal: '2022:01:01 00:00:00+13:00',
|
||||
FileCreateDate: '2022:01:01 00:00:00+13:00',
|
||||
FileModifyDate: '2022:01:01 00:00:00+13:00',
|
||||
},
|
||||
expected: {
|
||||
localDateTime: '2022-01-01T00:00:00.000Z',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue