mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): handle invalid coordinates (#2648)
This commit is contained in:
parent
9807f76aff
commit
1b301984dd
4 changed files with 76 additions and 9 deletions
|
|
@ -22,6 +22,7 @@ import fs from 'node:fs';
|
|||
import sharp from 'sharp';
|
||||
import { Repository } from 'typeorm/repository/Repository';
|
||||
import { promisify } from 'util';
|
||||
import { parseLatitude, parseLongitude } from '../utils/coordinates';
|
||||
|
||||
const ffprobe = promisify<string, FfprobeData>(ffmpeg.ffprobe);
|
||||
|
||||
|
|
@ -174,8 +175,8 @@ export class MetadataExtractionProcessor {
|
|||
// files MAY return an array of numbers instead.
|
||||
const iso = getExifProperty('ISO');
|
||||
newExif.iso = Array.isArray(iso) ? iso[0] : iso || null;
|
||||
newExif.latitude = getExifProperty('GPSLatitude');
|
||||
newExif.longitude = getExifProperty('GPSLongitude');
|
||||
newExif.latitude = parseLatitude(getExifProperty('GPSLatitude'));
|
||||
newExif.longitude = parseLongitude(getExifProperty('GPSLongitude'));
|
||||
newExif.livePhotoCID = getExifProperty('MediaGroupUUID');
|
||||
|
||||
if (newExif.livePhotoCID && !asset.livePhotoVideoId) {
|
||||
|
|
@ -274,8 +275,8 @@ export class MetadataExtractionProcessor {
|
|||
const match = location.match(locationRegex);
|
||||
|
||||
if (match?.length === 3) {
|
||||
newExif.latitude = parseFloat(match[1]);
|
||||
newExif.longitude = parseFloat(match[2]);
|
||||
newExif.latitude = parseLatitude(match[1]);
|
||||
newExif.longitude = parseLongitude(match[2]);
|
||||
}
|
||||
} else if (videoTags && videoTags['com.apple.quicktime.location.ISO6709']) {
|
||||
const location = videoTags['com.apple.quicktime.location.ISO6709'] as string;
|
||||
|
|
@ -283,8 +284,8 @@ export class MetadataExtractionProcessor {
|
|||
const match = location.match(locationRegex);
|
||||
|
||||
if (match?.length === 4) {
|
||||
newExif.latitude = parseFloat(match[1]);
|
||||
newExif.longitude = parseFloat(match[2]);
|
||||
newExif.latitude = parseLatitude(match[1]);
|
||||
newExif.longitude = parseLongitude(match[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue