mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-10-08 00:02:41 -04:00
Raise error correctly on bad url scheme, fixes #156
This commit is contained in:
parent
e7d8111784
commit
a891d8f43a
@ -291,6 +291,8 @@ class FastImage
|
||||
end
|
||||
|
||||
def fetch_using_http_from_parsed_uri
|
||||
raise ImageFetchFailure unless @parsed_uri.is_a?(URI::HTTP)
|
||||
|
||||
http_header = {'Accept-Encoding' => 'identity'}.merge(@options[:http_header])
|
||||
|
||||
setup_http
|
||||
|
@ -535,4 +535,9 @@ class FastImageTest < Test::Unit::TestCase
|
||||
fi.size
|
||||
assert_equal 322, fi.content_length
|
||||
end
|
||||
|
||||
def test_unknown_protocol
|
||||
FakeWeb.register_uri(:get, "http://example.com/test", body: "", location: "hhttp://example.com", :status => 301)
|
||||
assert_nil FastImage.size("http://example.com/test")
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user