fix(upload.custom-types): army has a custom format for crypted zip. not recognized as an application/octet-stream by the browser. html5[accpet] attributes allows to use extensions. So we allow this extension
This commit is contained in:
parent
062477dede
commit
67856c2f13
1 changed files with 9 additions and 1 deletions
|
@ -53,7 +53,7 @@ class Attachment::EditComponent < ApplicationComponent
|
|||
data: {
|
||||
auto_attach_url: helpers.auto_attach_url(form.object)
|
||||
}.merge(has_file_size_validator? ? { max_file_size: max_file_size } : {})
|
||||
}.merge(has_content_type_validator? ? { accept: content_type_validator.options[:in].join(', ') } : {})
|
||||
}.merge(has_content_type_validator? ? { accept: accept_content_type } : {})
|
||||
end
|
||||
|
||||
def input_id(given_id)
|
||||
|
@ -100,6 +100,14 @@ class Attachment::EditComponent < ApplicationComponent
|
|||
.find { |validator| validator.class == ActiveStorageValidations::ContentTypeValidator }
|
||||
end
|
||||
|
||||
def accept_content_type
|
||||
list = content_type_validator.options[:in]
|
||||
if list.include?("application/octet-stream")
|
||||
list.push(".acidcsa")
|
||||
end
|
||||
list.join(', ')
|
||||
end
|
||||
|
||||
def has_content_type_validator?
|
||||
!content_type_validator.nil?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue