Fix: Exif parsers should accept longtitude up to 180 degrees (#1260)

This commit is contained in:
Nikolay Kalinin
2025-07-23 19:38:23 +02:00
committed by GitHub
parent b55a80f5b9
commit 0b157b330a
2 changed files with 4 additions and 4 deletions

View File

@@ -79,9 +79,9 @@ func extractValidGpsData(fileInfo *exiftool.FileMetadata, mediaPath string) (*fl
}
// GPS data validation
if (GPSLat != nil && math.Abs(*GPSLat) > 90) || (GPSLong != nil && math.Abs(*GPSLong) > 90) {
if (GPSLat != nil && math.Abs(*GPSLat) > 90) || (GPSLong != nil && math.Abs(*GPSLong) > 180) {
log.Printf(
"Incorrect GPS data in the %s Exif data: %f, %f, while expected values between '-90' and '90'. Ignoring GPS data.",
"Incorrect GPS data in the %s Exif data: %f, %f, while expected latitude between '-90' and '90', and longitude between '-180' and '180'. Ignoring GPS data.",
mediaPath, *GPSLat, *GPSLong)
return nil, nil
}

View File

@@ -144,10 +144,10 @@ func (p internalExifParser) ParseExif(mediaPath string) (returnExif *models.Medi
lat, long, err := exifTags.LatLong()
if err == nil {
if math.Abs(lat) > 90 || math.Abs(long) > 90 {
if math.Abs(lat) > 90 || math.Abs(long) > 180 {
returnExif = &newExif
log.Printf(
"Incorrect GPS data in the %s Exif data: %f, %f, while expected values between '-90' and '90'. Ignoring GPS data.",
"Incorrect GPS data in the %s Exif data: %f, %f, while expected latitude between '-90' and '90', and longitude between '-180' and '180'. Ignoring GPS data.",
mediaPath, long, lat)
return
} else {