diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-05-12 14:31:29 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-05-13 11:46:10 -0500 |
commit | 4328bc1769c52393580cb777d34dbd6ebff089cf (patch) | |
tree | 51c58b1d6dd11f491c7c0b82b182ac81bcf07aa5 /app/models/blob_viewer/base.rb | |
parent | 361b2b135ff020cb628f1d0617e191a8bde620bf (diff) | |
download | gitlab-ce-4328bc1769c52393580cb777d34dbd6ebff089cf.tar.gz |
Allow blob viewer to support multiple filetypes
Diffstat (limited to 'app/models/blob_viewer/base.rb')
-rw-r--r-- | app/models/blob_viewer/base.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/blob_viewer/base.rb b/app/models/blob_viewer/base.rb index 4f38c31714b..7164e4ece78 100644 --- a/app/models/blob_viewer/base.rb +++ b/app/models/blob_viewer/base.rb @@ -2,7 +2,7 @@ module BlobViewer class Base PARTIAL_PATH_PREFIX = 'projects/blob/viewers'.freeze - class_attribute :partial_name, :loading_partial_name, :type, :extensions, :file_type, :client_side, :binary, :switcher_icon, :switcher_title, :max_size, :absolute_max_size + class_attribute :partial_name, :loading_partial_name, :type, :extensions, :file_types, :client_side, :binary, :switcher_icon, :switcher_title, :max_size, :absolute_max_size self.loading_partial_name = 'loading' @@ -54,17 +54,17 @@ module BlobViewer def self.can_render?(blob, verify_binary: true) return false if verify_binary && binary? != blob.binary? return true if extensions&.include?(blob.extension) - return true if file_type && Gitlab::FileDetector.type_of(blob.path) == file_type + return true if file_types&.include?(Gitlab::FileDetector.type_of(blob.path)) false end def too_large? - blob.raw_size > max_size + max_size && blob.raw_size > max_size end def absolutely_too_large? - blob.raw_size > absolute_max_size + absolute_max_size && blob.raw_size > absolute_max_size end def can_override_max_size? |