Permalink
Browse files

Fix for URI::InvalidURIError: bad URI(is not URI?). For example, URI('h…

…ttp://google.com/åäö') fails otherwise.
  • Loading branch information...
1 parent 57a58bc commit 2cfda4a8f5db9d883e3f385d768dafda520eee33 @christianhellsten committed May 20, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/anemone/http.rb
View
@@ -112,7 +112,7 @@ def get(url, referer = nil)
response, response_time = get_response(loc, referer)
code = Integer(response.code)
- redirect_to = response.is_a?(Net::HTTPRedirection) ? URI(response['location']).normalize : nil
+ redirect_to = response.is_a?(Net::HTTPRedirection) ? URI(URI.escape(response['location'])).normalize : nil
yield response, code, loc, redirect_to, response_time
limit -= 1
end while (loc = redirect_to) && allowed?(redirect_to, url) && limit > 0

3 comments on commit 2cfda4a

Hey even i used to get this error . i hope this should solve the issue

This is a quick-fix and most likely doesn't solve all issues. Using the Addressable gem instead of Ruby's URI would be a better solution, but requires more work.

Please sign in to comment.