1
0
Fork 0
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 ()

fix: thumbnail generation of external assets
This commit is contained in:
Jonathan Jogenfors 2025-01-09 00:12:39 +01:00 committed by GitHub
parent cc10fc15c3
commit bab04378dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 1 deletions

View file

@ -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,

View file

@ -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',
},
},
],

View file

@ -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' },
});
}