Skip to content
Snippets Groups Projects
Commit 7b0f37a9 authored by Alex Reisner's avatar Alex Reisner
Browse files

Truncate Mapbox query at semicolon.

Fixes #1299.
parent 006cb5f4
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,9 @@ module Geocoder::Lookup
lat,lon = query.coordinates
"#{CGI.escape lon},#{CGI.escape lat}"
else
CGI.escape query.text.to_s
# truncate at first semicolon so Mapbox doesn't go into batch mode
# (see Github issue #1299)
CGI.escape query.text.to_s.split(';').first.to_s
end
end
......
......@@ -44,4 +44,9 @@ class MapboxTest < GeocoderTestCase
Geocoder.search("invalid api key")
end
end
def test_truncates_query_at_semicolon
result = Geocoder.search("Madison Square Garden, New York, NY;123 Another St").first
assert_equal [40.749688, -73.991566], result.coordinates
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment