mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 17:19:03 +00:00
Fix: Exif parsers should accept longtitude up to 180 degrees (#1260)
This commit is contained in:
@@ -79,9 +79,9 @@ func extractValidGpsData(fileInfo *exiftool.FileMetadata, mediaPath string) (*fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GPS data validation
|
// 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(
|
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)
|
mediaPath, *GPSLat, *GPSLong)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,10 +144,10 @@ func (p internalExifParser) ParseExif(mediaPath string) (returnExif *models.Medi
|
|||||||
|
|
||||||
lat, long, err := exifTags.LatLong()
|
lat, long, err := exifTags.LatLong()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if math.Abs(lat) > 90 || math.Abs(long) > 90 {
|
if math.Abs(lat) > 90 || math.Abs(long) > 180 {
|
||||||
returnExif = &newExif
|
returnExif = &newExif
|
||||||
log.Printf(
|
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)
|
mediaPath, long, lat)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user