[Cleanup] Remove unused size method from file class

This commit is contained in:
Earlopain 2024-04-26 15:58:18 +02:00
parent b058077cf0
commit 75ea36b700
No known key found for this signature in database
GPG Key ID: 48860312319ADF61
2 changed files with 0 additions and 17 deletions

View File

@ -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, **)

View File

@ -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" })