mirror of
https://github.com/immich-app/immich.git
synced 2025-06-02 21:24:28 -04:00
fix(server): generate thumbnails for external assets (#15183)
fix: thumbnail generation of external assets
This commit is contained in:
parent
cc10fc15c3
commit
bab04378dc
@ -301,10 +301,38 @@ describe('/libraries', () => {
|
|||||||
|
|
||||||
const { assets } = await utils.searchAssets(admin.accessToken, {
|
const { assets } = await utils.searchAssets(admin.accessToken, {
|
||||||
originalPath: `${testAssetDirInternal}/temp/directoryA/assetA.png`,
|
originalPath: `${testAssetDirInternal}/temp/directoryA/assetA.png`,
|
||||||
|
libraryId: library.id,
|
||||||
});
|
});
|
||||||
expect(assets.count).toBe(1);
|
expect(assets.count).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should process metadata and thumbnails for external asset', async () => {
|
||||||
|
const library = await utils.createLibrary(admin.accessToken, {
|
||||||
|
ownerId: admin.userId,
|
||||||
|
importPaths: [`${testAssetDirInternal}/temp/directoryA`],
|
||||||
|
});
|
||||||
|
|
||||||
|
const { status } = await request(app)
|
||||||
|
.post(`/libraries/${library.id}/scan`)
|
||||||
|
.set('Authorization', `Bearer ${admin.accessToken}`)
|
||||||
|
.send();
|
||||||
|
expect(status).toBe(204);
|
||||||
|
|
||||||
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
await utils.waitForQueueFinish(admin.accessToken, 'metadataExtraction');
|
||||||
|
await utils.waitForQueueFinish(admin.accessToken, 'thumbnailGeneration');
|
||||||
|
|
||||||
|
const { assets } = await utils.searchAssets(admin.accessToken, {
|
||||||
|
originalPath: `${testAssetDirInternal}/temp/directoryA/assetA.png`,
|
||||||
|
libraryId: library.id,
|
||||||
|
});
|
||||||
|
expect(assets.count).toBe(1);
|
||||||
|
const asset = assets.items[0];
|
||||||
|
expect(asset.exifInfo).not.toBe(null);
|
||||||
|
expect(asset.exifInfo?.dateTimeOriginal).not.toBe(null);
|
||||||
|
expect(asset.thumbhash).not.toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
it('should scan external library with exclusion pattern', async () => {
|
it('should scan external library with exclusion pattern', async () => {
|
||||||
const library = await utils.createLibrary(admin.accessToken, {
|
const library = await utils.createLibrary(admin.accessToken, {
|
||||||
ownerId: admin.userId,
|
ownerId: admin.userId,
|
||||||
|
@ -425,6 +425,7 @@ describe(LibraryService.name, () => {
|
|||||||
name: JobName.SIDECAR_DISCOVERY,
|
name: JobName.SIDECAR_DISCOVERY,
|
||||||
data: {
|
data: {
|
||||||
id: assetStub.image.id,
|
id: assetStub.image.id,
|
||||||
|
source: 'upload',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -469,6 +470,7 @@ describe(LibraryService.name, () => {
|
|||||||
name: JobName.SIDECAR_DISCOVERY,
|
name: JobName.SIDECAR_DISCOVERY,
|
||||||
data: {
|
data: {
|
||||||
id: assetStub.image.id,
|
id: assetStub.image.id,
|
||||||
|
source: 'upload',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -426,7 +426,7 @@ export class LibraryService extends BaseService {
|
|||||||
// We queue a sidecar discovery which, in turn, queues metadata extraction
|
// We queue a sidecar discovery which, in turn, queues metadata extraction
|
||||||
await this.jobRepository.queue({
|
await this.jobRepository.queue({
|
||||||
name: JobName.SIDECAR_DISCOVERY,
|
name: JobName.SIDECAR_DISCOVERY,
|
||||||
data: { id: asset.id },
|
data: { id: asset.id, source: 'upload' },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user