Refactor FileHelper to use keyword arguments.

This commit is contained in:
Robin Ward
2017-05-24 13:42:52 -04:00
parent 87ac758f05
commit cdbe027c1c
12 changed files with 81 additions and 15 deletions

View File

@ -62,7 +62,11 @@ class UploadsController < ApplicationController
if file.nil?
if url.present? && is_api?
maximum_upload_size = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
tempfile = FileHelper.download(url, maximum_upload_size, "discourse-upload-#{type}") rescue nil
tempfile = FileHelper.download(
url,
max_file_size: maximum_upload_size,
tmp_file_name: "discourse-upload-#{type}"
) rescue nil
filename = File.basename(URI.parse(url).path)
end
else