fix: exif gps parsing of malformed data (#23551)
* fix: exif gps parsing of malformed data * chore: e2e testpull/23563/head
parent
619de2a5e4
commit
517c3e1d4c
|
|
@ -1140,6 +1140,16 @@ describe('/asset', () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
input: 'metadata/gps-position/empty_gps.jpg',
|
||||||
|
expected: {
|
||||||
|
type: AssetTypeEnum.Image,
|
||||||
|
exifInfo: {
|
||||||
|
latitude: null,
|
||||||
|
longitude: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
it.each(tests)(`should upload and generate a thumbnail for different file types`, async ({ input, expected }) => {
|
it.each(tests)(`should upload and generate a thumbnail for different file types`, async ({ input, expected }) => {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 37f60ea537c0228f5f92e4f42dc42f0bb39a6d7f
|
Subproject commit 68e8b5853cdc2d76c5e6f18a6d1773793728c491
|
||||||
|
|
@ -236,8 +236,8 @@ export class MetadataService extends BaseService {
|
||||||
latitude: number | null = null,
|
latitude: number | null = null,
|
||||||
longitude: number | null = null;
|
longitude: number | null = null;
|
||||||
if (this.hasGeo(exifTags)) {
|
if (this.hasGeo(exifTags)) {
|
||||||
latitude = exifTags.GPSLatitude;
|
latitude = Number(exifTags.GPSLatitude);
|
||||||
longitude = exifTags.GPSLongitude;
|
longitude = Number(exifTags.GPSLongitude);
|
||||||
if (reverseGeocoding.enabled) {
|
if (reverseGeocoding.enabled) {
|
||||||
geo = await this.mapRepository.reverseGeocode({ latitude, longitude });
|
geo = await this.mapRepository.reverseGeocode({ latitude, longitude });
|
||||||
}
|
}
|
||||||
|
|
@ -894,12 +894,10 @@ export class MetadataService extends BaseService {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private hasGeo(tags: ImmichTags): tags is ImmichTags & { GPSLatitude: number; GPSLongitude: number } {
|
private hasGeo(tags: ImmichTags) {
|
||||||
return (
|
const lat = Number(tags.GPSLatitude);
|
||||||
tags.GPSLatitude !== undefined &&
|
const lng = Number(tags.GPSLongitude);
|
||||||
tags.GPSLongitude !== undefined &&
|
return !Number.isNaN(lat) && !Number.isNaN(lng) && (lat !== 0 || lng !== 0);
|
||||||
(tags.GPSLatitude !== 0 || tags.GPSLatitude !== 0)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getAutoStackId(tags: ImmichTags | null): string | null {
|
private getAutoStackId(tags: ImmichTags | null): string | null {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue