lib/onebox/engine/google_maps_onebox.rb in onebox-1.9.19 vs lib/onebox/engine/google_maps_onebox.rb in onebox-1.9.20
- old
+ new
@@ -167,11 +167,12 @@
uri = URI(@url)
begin
http = Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https', open_timeout: timeout, read_timeout: timeout)
response = http.head(uri.path)
- raise "unexpected response code #{response.code}" unless %w(301 302).include?(response.code)
- @url = response["Location"]
+
+ raise "unexpected response code #{response.code}" unless %w(200 301 302).include?(response.code)
+ @url = response.code == "200" ? uri.to_s : response["Location"]
ensure
http.finish rescue nil
end
end