Skip to content
Snippets Groups Projects
Commit 3a390fba authored by johngallagher's avatar johngallagher
Browse files

stripping leadding and trailing whitespace from location input

parent b469da13
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ module Geocoder::Lookup ...@@ -29,7 +29,7 @@ module Geocoder::Lookup
end end
def sanitized_text(query) def sanitized_text(query)
URI.escape(query.sanitized_text) if !query.reverse_geocode? URI.escape(query.sanitized_text.strip) if !query.reverse_geocode?
end end
def results(query) def results(query)
......
...@@ -274,6 +274,16 @@ class ServicesTest < Test::Unit::TestCase ...@@ -274,6 +274,16 @@ class ServicesTest < Test::Unit::TestCase
assert_no_match /query/, url assert_no_match /query/, url
end end
def test_bing_query_url_contains_address_with_trailing_and_leading_spaces
lookup = Geocoder::Lookup::Bing.new
url = lookup.query_url(Geocoder::Query.new(
" manchester, lancashire ",
:region => "uk"
))
assert_match /Locations\/uk\/manchester,%20lancashire/, url
assert_no_match /query/, url
end
# --- Nominatim --- # --- Nominatim ---
def test_nominatim_result_components def test_nominatim_result_components
......
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