prefer file over source when both are provided (#3767)

This commit is contained in:
Albert Yi
2018-06-25 13:59:43 -07:00
parent 160998daca
commit c17e0baad0
2 changed files with 11 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ class UploadService
def self.prepare(url: nil, file: nil, ref: nil)
upload = Upload.new
if url
if Utils.is_downloadable?(url) && file.nil?
download = Downloads::File.new(url)
normalized_url, _, _ = download.before_download(url, {})
post = if normalized_url.nil?