You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
fix(server): do not reset fileCreatedDate (#15650)
When marking an offline asset as online again, do not reset the fileCreatedAt value. This value contains the "true" date, copied from exif.dateTimeOriginal. If we overwrite this value, we'd need to run the metadata extraction job again. Instead, we just leave the old (and correct) value in place. fixes #15640
This commit is contained in:
@ -337,12 +337,31 @@ describe(LibraryService.name, () => {
|
||||
|
||||
expect(assetMock.updateAll).toHaveBeenCalledWith([assetStub.trashedOffline.id], {
|
||||
deletedAt: null,
|
||||
fileCreatedAt: assetStub.trashedOffline.fileModifiedAt,
|
||||
fileModifiedAt: assetStub.trashedOffline.fileModifiedAt,
|
||||
isOffline: false,
|
||||
originalFileName: 'path.jpg',
|
||||
});
|
||||
});
|
||||
|
||||
it('should not touch fileCreatedAt when un-trashing an asset previously marked as offline', async () => {
|
||||
const mockAssetJob: ILibraryAssetJob = {
|
||||
id: assetStub.external.id,
|
||||
importPaths: ['/'],
|
||||
exclusionPatterns: [],
|
||||
};
|
||||
|
||||
assetMock.getById.mockResolvedValue(assetStub.trashedOffline);
|
||||
storageMock.stat.mockResolvedValue({ mtime: assetStub.trashedOffline.fileModifiedAt } as Stats);
|
||||
|
||||
await expect(sut.handleSyncAsset(mockAssetJob)).resolves.toBe(JobStatus.SUCCESS);
|
||||
|
||||
expect(assetMock.updateAll).toHaveBeenCalledWith(
|
||||
[assetStub.trashedOffline.id],
|
||||
expect.not.objectContaining({
|
||||
fileCreatedAt: expect.anything(),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('should update file when mtime has changed', async () => {
|
||||
@ -360,7 +379,6 @@ describe(LibraryService.name, () => {
|
||||
|
||||
expect(assetMock.updateAll).toHaveBeenCalledWith([assetStub.external.id], {
|
||||
fileModifiedAt: newMTime,
|
||||
fileCreatedAt: newMTime,
|
||||
isOffline: false,
|
||||
originalFileName: 'photo.jpg',
|
||||
deletedAt: null,
|
||||
|
@ -511,7 +511,6 @@ export class LibraryService extends BaseService {
|
||||
await this.assetRepository.updateAll([asset.id], {
|
||||
isOffline: false,
|
||||
deletedAt: null,
|
||||
fileCreatedAt: mtime,
|
||||
fileModifiedAt: mtime,
|
||||
originalFileName: parse(asset.originalPath).base,
|
||||
});
|
||||
|
Reference in New Issue
Block a user