From ce84d1835332932e25ebdc2cfbe44ff301328a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Tue, 30 Jan 2018 14:38:10 -0500 Subject: apply fixes from feedback --- app/uploaders/file_uploader.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'app/uploaders/file_uploader.rb') 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 -- cgit v1.2.3