diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-27 21:03:39 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-27 21:03:39 +0000 |
commit | ce1fa35a553be562ada3717d90908d8b4b12d9ad (patch) | |
tree | fdbfdcdbabf570a340619290d028465d8422b308 /lib/uploaded_file.rb | |
parent | 7c9f211b4678a30c1b228336b3b601fa81673bb5 (diff) | |
download | gitlab-ce-ce1fa35a553be562ada3717d90908d8b4b12d9ad.tar.gz |
Add latest changes from gitlab-org/security/gitlab@12-10-stable-ee
Diffstat (limited to 'lib/uploaded_file.rb')
-rw-r--r-- | lib/uploaded_file.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/uploaded_file.rb b/lib/uploaded_file.rb index f8d596b5d14..73029c934f4 100644 --- a/lib/uploaded_file.rb +++ b/lib/uploaded_file.rb @@ -42,13 +42,14 @@ class UploadedFile @remote_id = remote_id end - def self.from_params(params, field, upload_paths) - path = params["#{field}.path"] + def self.from_params(params, field, upload_paths, path_override = nil) + path = path_override || params["#{field}.path"] remote_id = params["#{field}.remote_id"] return if path.blank? && remote_id.blank? - file_path = nil - if path.present? + if remote_id.present? # don't use file_path if remote_id is set + file_path = nil + elsif path.present? file_path = File.realpath(path) paths = Array(upload_paths) << Dir.tmpdir |