mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 01:11:36 +03:00
fix: rework file handling so we always explicitly create, overwrite or both (#12812)
This commit is contained in:
@@ -511,7 +511,7 @@ describe(MetadataService.name, () => {
|
||||
|
||||
await sut.handleMetadataExtraction({ id: assetStub.livePhotoMotionAsset.id });
|
||||
expect(assetMock.getByIds).toHaveBeenCalledWith([assetStub.livePhotoMotionAsset.id]);
|
||||
expect(storageMock.writeFile).not.toHaveBeenCalled();
|
||||
expect(storageMock.createOrOverwriteFile).not.toHaveBeenCalled();
|
||||
expect(jobMock.queue).not.toHaveBeenCalled();
|
||||
expect(jobMock.queueAll).not.toHaveBeenCalled();
|
||||
expect(assetMock.update).not.toHaveBeenCalledWith(
|
||||
@@ -581,7 +581,7 @@ describe(MetadataService.name, () => {
|
||||
type: AssetType.VIDEO,
|
||||
});
|
||||
expect(userMock.updateUsage).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.ownerId, 512);
|
||||
expect(storageMock.writeFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);
|
||||
expect(storageMock.createFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);
|
||||
expect(assetMock.update).toHaveBeenNthCalledWith(1, {
|
||||
id: assetStub.livePhotoWithOriginalFileName.id,
|
||||
livePhotoVideoId: fileStub.livePhotoMotion.uuid,
|
||||
@@ -624,7 +624,7 @@ describe(MetadataService.name, () => {
|
||||
type: AssetType.VIDEO,
|
||||
});
|
||||
expect(userMock.updateUsage).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.ownerId, 512);
|
||||
expect(storageMock.writeFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);
|
||||
expect(storageMock.createFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);
|
||||
expect(assetMock.update).toHaveBeenNthCalledWith(1, {
|
||||
id: assetStub.livePhotoWithOriginalFileName.id,
|
||||
livePhotoVideoId: fileStub.livePhotoMotion.uuid,
|
||||
@@ -668,7 +668,7 @@ describe(MetadataService.name, () => {
|
||||
type: AssetType.VIDEO,
|
||||
});
|
||||
expect(userMock.updateUsage).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.ownerId, 512);
|
||||
expect(storageMock.writeFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);
|
||||
expect(storageMock.createFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);
|
||||
expect(assetMock.update).toHaveBeenNthCalledWith(1, {
|
||||
id: assetStub.livePhotoWithOriginalFileName.id,
|
||||
livePhotoVideoId: fileStub.livePhotoMotion.uuid,
|
||||
@@ -716,7 +716,7 @@ describe(MetadataService.name, () => {
|
||||
|
||||
await sut.handleMetadataExtraction({ id: assetStub.livePhotoStillAsset.id });
|
||||
expect(assetMock.create).toHaveBeenCalledTimes(0);
|
||||
expect(storageMock.writeFile).toHaveBeenCalledTimes(0);
|
||||
expect(storageMock.createOrOverwriteFile).toHaveBeenCalledTimes(0);
|
||||
// The still asset gets saved by handleMetadataExtraction, but not the video
|
||||
expect(assetMock.update).toHaveBeenCalledTimes(1);
|
||||
expect(jobMock.queue).toHaveBeenCalledTimes(0);
|
||||
|
||||
Reference in New Issue
Block a user