Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(location): handle invalid or null GPS coordinates

Timothy Yine0fbe9d0b214
diff --git a/server/services/location/geocoding.ts b/server/services/location/geocoding.ts
index b358f602..9833996b 100644
--- a/server/services/location/geocoding.ts
+++ b/server/services/location/geocoding.ts
@@ -268,7 +268,7 @@ export function parseGPSCoordinates(exifData: any): {
}
// 如果上面的方法失败,尝试从GPSCoordinates获取
- if ((latitude == null || longitude == null) && exifData.GPSCoordinates) {
+ if (!hasValidCoordinates(latitude, longitude) && exifData.GPSCoordinates) {
const coords = exifData.GPSCoordinates.toString()
const match = coords.match(/([-+]?\d+\.?\d*)[°,\s]+([-+]?\d+\.?\d*)/)
if (match) {