Carrierwave: change the method name to extension_whitelist for filter uploader file extension

This commit is contained in:
pedong 2019-05-07 13:20:20 +02:00
parent 3435349b66
commit f0ed61cce8
5 changed files with 6 additions and 6 deletions

View file

@ -20,7 +20,7 @@ class AttestationTemplateLogoUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded. # Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this: # For images you might use something like this:
def extension_white_list def extension_whitelist
['jpg', 'jpeg', 'png'] ['jpg', 'jpeg', 'png']
end end

View file

@ -20,7 +20,7 @@ class AttestationTemplateSignatureUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded. # Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this: # For images you might use something like this:
def extension_white_list def extension_whitelist
['jpg', 'jpeg', 'png'] ['jpg', 'jpeg', 'png']
end end

View file

@ -13,11 +13,11 @@ class CommentaireFileUploader < BaseUploader
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
def extension_white_list def extension_whitelist
['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'jpg', 'jpeg', 'png', 'zip', 'txt'] ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'jpg', 'jpeg', 'png', 'zip', 'txt']
end end
def accept_extension_list def accept_extension_list
extension_white_list.map { |e| ".#{e}" }.join(",") extension_whitelist.map { |e| ".#{e}" }.join(",")
end end
end end

View file

@ -18,7 +18,7 @@ class PieceJustificativeUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded. # Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this: # For images you might use something like this:
def extension_white_list def extension_whitelist
['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'jpg', 'jpeg', 'png'] ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'jpg', 'jpeg', 'png']
end end

View file

@ -20,7 +20,7 @@ class ProcedureLogoUploader < BaseUploader
# Add a white list of extensions which are allowed to be uploaded. # Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this: # For images you might use something like this:
def extension_white_list def extension_whitelist
['jpg', 'jpeg', 'png'] ['jpg', 'jpeg', 'png']
end end