mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): strip metadata from thumbnails (#4438)
included all thumbnail metadata. It seems this has to be explicitly disabled. Refs: #4382 feat. basic metadata e2e test fix: use tiff thumbnails in first step + e2e fix fix: revert switch to tiff feat: test metadata of both webp and jpg feat: use upload in e2e test fix: lint strip metadata with exiftool use `withIccProfile` fix e2e formatting run jobs in e2e
This commit is contained in:
parent
1d0dbdff67
commit
c0ebc943d2
4 changed files with 113 additions and 3 deletions
91
server/test/e2e/metadata.e2e-spec.ts
Normal file
91
server/test/e2e/metadata.e2e-spec.ts
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
import { AssetResponseDto, LoginResponseDto } from '@app/domain';
|
||||
import { AssetController } from '@app/immich';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { api } from '@test/api';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import {
|
||||
IMMICH_TEST_ASSET_PATH,
|
||||
IMMICH_TEST_ASSET_TEMP_PATH,
|
||||
db,
|
||||
itif,
|
||||
restoreTempFolder,
|
||||
runAllTests,
|
||||
testApp,
|
||||
} from '@test/test-utils';
|
||||
import { exiftool } from 'exiftool-vendored';
|
||||
|
||||
describe(`${AssetController.name} (e2e)`, () => {
|
||||
let app: INestApplication;
|
||||
let server: any;
|
||||
let admin: LoginResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await testApp.create({ jobs: true });
|
||||
server = app.getHttpServer();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await db.reset();
|
||||
await restoreTempFolder();
|
||||
await api.authApi.adminSignUp(server);
|
||||
admin = await api.authApi.adminLogin(server);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await db.disconnect();
|
||||
await app.close();
|
||||
await restoreTempFolder();
|
||||
});
|
||||
|
||||
describe.only('should strip metadata of', () => {
|
||||
let assetWithLocation: AssetResponseDto;
|
||||
|
||||
beforeEach(async () => {
|
||||
const fileContent = await fs.promises.readFile(
|
||||
`${IMMICH_TEST_ASSET_PATH}/metadata/gps-position/thompson-springs.jpg`,
|
||||
);
|
||||
|
||||
await api.assetApi.upload(server, admin.accessToken, 'test-asset-id', { content: fileContent });
|
||||
|
||||
const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
|
||||
expect(assets).toHaveLength(1);
|
||||
assetWithLocation = assets[0];
|
||||
|
||||
expect(assetWithLocation).toEqual(
|
||||
expect.objectContaining({
|
||||
exifInfo: expect.objectContaining({ latitude: 39.115, longitude: -108.400968333333 }),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
itif(runAllTests)('small webp thumbnails', async () => {
|
||||
const assetId = assetWithLocation.id;
|
||||
|
||||
const thumbnail = await api.assetApi.getWebpThumbnail(server, admin.accessToken, assetId);
|
||||
|
||||
await fs.promises.writeFile(`${IMMICH_TEST_ASSET_TEMP_PATH}/thumbnail.webp`, thumbnail);
|
||||
|
||||
const exifData = await exiftool.read(`${IMMICH_TEST_ASSET_TEMP_PATH}/thumbnail.webp`);
|
||||
|
||||
expect(exifData).not.toHaveProperty('GPSLongitude');
|
||||
expect(exifData).not.toHaveProperty('GPSLatitude');
|
||||
});
|
||||
|
||||
itif(runAllTests)('large jpeg thumbnails', async () => {
|
||||
const assetId = assetWithLocation.id;
|
||||
|
||||
const thumbnail = await api.assetApi.getJpegThumbnail(server, admin.accessToken, assetId);
|
||||
|
||||
await fs.promises.writeFile(`${IMMICH_TEST_ASSET_TEMP_PATH}/thumbnail.jpg`, thumbnail);
|
||||
|
||||
const exifData = await exiftool.read(`${IMMICH_TEST_ASSET_TEMP_PATH}/thumbnail.jpg`);
|
||||
|
||||
console.log(assetWithLocation);
|
||||
|
||||
expect(exifData).not.toHaveProperty('GPSLongitude');
|
||||
expect(exifData).not.toHaveProperty('GPSLatitude');
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue