Skip to content

Commit

Permalink
ignore name "parameter" from malformed geo uri when coming from organ…
Browse files Browse the repository at this point in the history
…icmaps (noticed while investigating #6101)
  • Loading branch information
westnordost committed Jan 17, 2025
1 parent d730309 commit 83c405a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import de.westnordost.streetcomplete.util.ktx.format
fun parseGeoUri(uri: String): GeoLocation? {
if (!uri.startsWith("geo:")) return null

val geoUriRegex = Regex("(-?[0-9]*\\.?[0-9]+),(-?[0-9]*\\.?[0-9]+).*?(?:\\?z=([0-9]*\\.?[0-9]+))?")
val geoUriRegex = Regex("(-?[0-9]*\\.?[0-9]+),(-?[0-9]*\\.?[0-9]+).*?(?:\\?z=([0-9]*\\.?[0-9]+))?.*")
val match = geoUriRegex.matchEntire(uri.substringAfter("geo:")) ?: return null

val latitude = match.groupValues[1].toDoubleOrNull() ?: return null
Expand Down

0 comments on commit 83c405a

Please sign in to comment.