forked from e621ng/e621ng
[Cleanup] Remove unused size method from file class
This commit is contained in:
parent
b058077cf0
commit
75ea36b700
@ -22,16 +22,6 @@ module Downloads
|
||||
validate!
|
||||
end
|
||||
|
||||
def size
|
||||
res = HTTParty.head(uncached_url, **httparty_options, timeout: 3)
|
||||
|
||||
if res.success?
|
||||
res.content_length
|
||||
else
|
||||
raise HTTParty::ResponseError.new(res)
|
||||
end
|
||||
end
|
||||
|
||||
def download!(tries: 3, **)
|
||||
Retriable.retriable(on: RETRIABLE_ERRORS, tries: tries, base_interval: 0) do
|
||||
http_get_streaming(uncached_url, **)
|
||||
|
@ -48,13 +48,6 @@ module Downloads
|
||||
assert_match("from 127.0.0.1 are not", error.message)
|
||||
end
|
||||
|
||||
should "not try to fetch the size" do
|
||||
error = assert_raises(Downloads::File::Error) do
|
||||
Downloads::File.new("http://evil.com").size
|
||||
end
|
||||
assert_match("from 127.0.0.1 are not", error.message)
|
||||
end
|
||||
|
||||
should "not follow redirects to banned IPs" do
|
||||
url = "http://httpbin.org/redirect-to?url=http://127.0.0.1"
|
||||
stub_request(:get, url).to_return(status: 301, headers: { location: "http://127.0.0.1" })
|
||||
|
Loading…
Reference in New Issue
Block a user