add download utils

This commit is contained in:
Pete Matsyburka authored and Oleksandr Turchyn committed 2024-09-09 13:57:46 +03:00
1 parent 71b8cc7172
commit 5a1efd0e27
5 files changed
+37 -22

No files matched your search

@@ -52,7 +52,7 @@ class TemplatesUploadsController < ApplicationController
def create_file_params_from_url
tempfile = Tempfile.new
tempfile.binmode
tempfile.write(conn.get(Addressable::URI.parse(params[:url]).display_uri.to_s).body)
tempfile.write(DownloadUtils.call(params[:url]).body)
tempfile.rewind
file = ActionDispatch::Http::UploadedFile.new(
@@ -65,10 +65,4 @@ class TemplatesUploadsController < ApplicationController
{ files: [file] }
end
def conn
Faraday.new do |faraday|
faraday.response :follow_redirects
end
end
end