lib/down/net_http.rb in down-4.2.1 vs lib/down/net_http.rb in down-4.3.0
- old
+ new
@@ -20,10 +20,11 @@
max_size = options.delete(:max_size)
max_redirects = options.delete(:max_redirects)
progress_proc = options.delete(:progress_proc)
content_length_proc = options.delete(:content_length_proc)
+ destination = options.delete(:destination)
open_uri_options = {
content_length_proc: proc { |size|
if size && max_size && size > max_size
raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
@@ -68,10 +69,10 @@
tempfile = ensure_tempfile(open_uri_file, File.extname(open_uri_file.base_uri.path))
OpenURI::Meta.init tempfile, open_uri_file # add back open-uri methods
tempfile.extend Down::NetHttp::DownloadedFile
- tempfile
+ download_result(tempfile, destination)
end
def open(url, options = {})
options = @options.merge(options)