mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 15:51:41 +00:00
compartir el nombre de archivo con JekyllService
This commit is contained in:
parent
f3df550494
commit
02b52b23b9
1 changed files with 26 additions and 0 deletions
26
app/models/active_storage/blob_decorator.rb
Normal file
26
app/models/active_storage/blob_decorator.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module ActiveStorage
|
||||||
|
# Modificaciones a ActiveStorage::Blob
|
||||||
|
module BlobDecorator
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
# Permitir que llegue el nombre de archivo al servicio de subida de
|
||||||
|
# archivos.
|
||||||
|
#
|
||||||
|
# @return [Hash]
|
||||||
|
def service_metadata
|
||||||
|
if forcibly_serve_as_binary?
|
||||||
|
{ content_type: ActiveStorage.binary_content_type, disposition: :attachment, filename: filename }
|
||||||
|
elsif !allowed_inline?
|
||||||
|
{ content_type: content_type, disposition: :attachment, filename: filename }
|
||||||
|
else
|
||||||
|
{ content_type: content_type, filename: filename }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ActiveStorage::Blob.include ActiveStorage::BlobDecorator
|
Loading…
Reference in a new issue