Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 00:03:39 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 00:03:39 +0300
commitce1fa35a553be562ada3717d90908d8b4b12d9ad (patch)
treefdbfdcdbabf570a340619290d028465d8422b308 /lib/uploaded_file.rb
parent7c9f211b4678a30c1b228336b3b601fa81673bb5 (diff)
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.rb9
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