mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
fix(server): handle NaN in metadata extraction (#4221)
Fallback to null in event of invalid number.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class RemoveInvalidCoordinates1695660378655 implements MigrationInterface {
|
||||
name = 'RemoveInvalidCoordinates1695660378655';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`UPDATE "exif" SET "latitude" = NULL WHERE "latitude" IN ('NaN', 'Infinity', '-Infinity')`);
|
||||
await queryRunner.query(
|
||||
`UPDATE "exif" SET "longitude" = NULL WHERE "longitude" IN ('NaN', 'Infinity', '-Infinity')`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(): Promise<void> {
|
||||
// Empty, data cannot be restored
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export class MetadataRepository implements IMetadataRepository {
|
||||
|
||||
getExifTags(path: string): Promise<ImmichTags | null> {
|
||||
return exiftool
|
||||
.read<ImmichTags>(path, undefined, {
|
||||
.read(path, undefined, {
|
||||
...DefaultReadTaskOptions,
|
||||
|
||||
defaultVideosToUTC: true,
|
||||
@@ -87,6 +87,6 @@ export class MetadataRepository implements IMetadataRepository {
|
||||
.catch((error) => {
|
||||
this.logger.warn(`Error reading exif data (${path}): ${error}`, error?.stack);
|
||||
return null;
|
||||
});
|
||||
}) as Promise<ImmichTags | null>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user