diff options
author | Micaël Bergeron <mbergeron@gitlab.com> | 2018-01-30 14:38:10 -0500 |
---|---|---|
committer | Micaël Bergeron <mbergeron@gitlab.com> | 2018-02-02 09:32:20 -0500 |
commit | ce84d1835332932e25ebdc2cfbe44ff301328a1f (patch) | |
tree | 6d7d61902152c05d6add90740defa1aa37ed9d5e /app | |
parent | 2b1536407fb42c1563fb41e2ee82e686e660ce11 (diff) | |
download | gitlab-ce-ce84d1835332932e25ebdc2cfbe44ff301328a1f.tar.gz |
apply fixes from feedback42547-upload-store-mount-point
Diffstat (limited to 'app')
-rw-r--r-- | app/models/upload.rb | 3 | ||||
-rw-r--r-- | app/uploaders/file_uploader.rb | 16 |
2 files changed, 10 insertions, 9 deletions
diff --git a/app/models/upload.rb b/app/models/upload.rb index 28baee95091..2024228537a 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -30,8 +30,7 @@ class Upload < ActiveRecord::Base end def build_uploader - uploader_class.new(model, mount_point, **uploader_context) - .tap do |uploader| + uploader_class.new(model, mount_point, **uploader_context).tap do |uploader| uploader.upload = self uploader.retrieve_from_store!(identifier) end diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index cc4e7a38165..2310e67cb2e 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -110,14 +110,16 @@ class FileUploader < GitlabUploader end def upload=(value) - unless apply_context!(value.uploader_context) - if matches = DYNAMIC_PATH_PATTERN.match(value.path) - @secret = matches[:secret] - @identifier = matches[:identifier] - end - end - super + + return unless value + return if apply_context!(value.uploader_context) + + # fallback to the regex based extraction + if matches = DYNAMIC_PATH_PATTERN.match(value.path) + @secret = matches[:secret] + @identifier = matches[:identifier] + end end def secret |