Merge pull request #7752 from mfo/helpcout/1988749
fix(upload.custom-types): army has a custom format for crypted zip. not recognized as an application/octet-stream by the browser. html5[accept] attributes allows to use extensions. So we allow this extension
This commit is contained in:
commit
cdf9fe6099
1 changed files with 9 additions and 1 deletions
|
@ -53,7 +53,7 @@ class Attachment::EditComponent < ApplicationComponent
|
||||||
data: {
|
data: {
|
||||||
auto_attach_url: helpers.auto_attach_url(form.object)
|
auto_attach_url: helpers.auto_attach_url(form.object)
|
||||||
}.merge(has_file_size_validator? ? { max_file_size: max_file_size } : {})
|
}.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
|
end
|
||||||
|
|
||||||
def input_id(given_id)
|
def input_id(given_id)
|
||||||
|
@ -100,6 +100,14 @@ class Attachment::EditComponent < ApplicationComponent
|
||||||
.find { |validator| validator.class == ActiveStorageValidations::ContentTypeValidator }
|
.find { |validator| validator.class == ActiveStorageValidations::ContentTypeValidator }
|
||||||
end
|
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?
|
def has_content_type_validator?
|
||||||
!content_type_validator.nil?
|
!content_type_validator.nil?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue