mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-12-30 00:05:02 -05:00
unescaped space symbol in redirect caused URI::InvalidURIError
This commit is contained in:
parent
c7cad12fa0
commit
abccdd1365
@ -250,7 +250,7 @@ class FastImage
|
||||
if res.is_a?(Net::HTTPRedirection) && @redirect_count < 4
|
||||
@redirect_count += 1
|
||||
begin
|
||||
@parsed_uri = URI.join(@parsed_uri, res['Location'])
|
||||
@parsed_uri = URI.join(@parsed_uri, URI.escape(res['Location']))
|
||||
rescue URI::InvalidURIError
|
||||
else
|
||||
fetch_using_http_from_parsed_uri
|
||||
|
||||
@ -248,8 +248,8 @@ class FastImageTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_should_handle_permanent_redirect_with_complex_relative_url
|
||||
register_redirect(TestUrl, "/photo.gne?rb=1&short=Vv4Und")
|
||||
register_redirect("#{TestUrl}photo.gne?rb=1&short=Vv4Und", "/" + GoodFixtures.keys.first)
|
||||
register_redirect(TestUrl, "/pho to.gne?rb=1&short=Vv4Und")
|
||||
register_redirect("#{TestUrl}pho%20to.gne?rb=1&short=Vv4Und", "/" + GoodFixtures.keys.first)
|
||||
assert_equal GoodFixtures[GoodFixtures.keys.first][1], FastImage.size(TestUrl, :raise_on_failure=>true)
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user