diff options
author | Micaël Bergeron <mbergeron@gitlab.com> | 2018-01-30 22:38:10 +0300 |
---|---|---|
committer | Micaël Bergeron <mbergeron@gitlab.com> | 2018-02-02 17:32:20 +0300 |
commit | ce84d1835332932e25ebdc2cfbe44ff301328a1f (patch) | |
tree | 6d7d61902152c05d6add90740defa1aa37ed9d5e /app/uploaders/file_uploader.rb | |
parent | 2b1536407fb42c1563fb41e2ee82e686e660ce11 (diff) |
apply fixes from feedback
Diffstat (limited to 'app/uploaders/file_uploader.rb')
-rw-r--r-- | app/uploaders/file_uploader.rb | 16 |
1 files changed, 9 insertions, 7 deletions
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 |