lib/bind_url/binder.rb in bind_url-0.1.2 vs lib/bind_url/binder.rb in bind_url-0.1.2.1

- old
+ new

@@ -48,10 +48,11 @@ private def download_as_tmp_file(url) res = RestClient.get(url) - file = Tempfile.new(["", Rack::Mime::MIME_TYPES.invert[res.headers[:content_type]]]) + ext = Pathname.new(URI(url).path).extname.presence || Rack::Mime::MIME_TYPES.invert[res.headers[:content_type]] + file = Tempfile.new(["", ext]) file.binmode file.write(res.body) file.flush file end