mirror of
https://github.com/immich-app/immich.git
synced 2025-01-27 22:22:45 +01:00
fix(server): generate thumbnails for external assets (#15183)
fix: thumbnail generation of external assets
This commit is contained in:
parent
cc10fc15c3
commit
bab04378dc
3 changed files with 31 additions and 1 deletions
|
@ -301,10 +301,38 @@ describe('/libraries', () => {
|
|||
|
||||
const { assets } = await utils.searchAssets(admin.accessToken, {
|
||||
originalPath: `${testAssetDirInternal}/temp/directoryA/assetA.png`,
|
||||
libraryId: library.id,
|
||||
});
|
||||
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 () => {
|
||||
const library = await utils.createLibrary(admin.accessToken, {
|
||||
ownerId: admin.userId,
|
||||
|
|
|
@ -425,6 +425,7 @@ describe(LibraryService.name, () => {
|
|||
name: JobName.SIDECAR_DISCOVERY,
|
||||
data: {
|
||||
id: assetStub.image.id,
|
||||
source: 'upload',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
@ -469,6 +470,7 @@ describe(LibraryService.name, () => {
|
|||
name: JobName.SIDECAR_DISCOVERY,
|
||||
data: {
|
||||
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
|
||||
await this.jobRepository.queue({
|
||||
name: JobName.SIDECAR_DISCOVERY,
|
||||
data: { id: asset.id },
|
||||
data: { id: asset.id, source: 'upload' },
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue