Class: Decidim::PrivateDownloadsController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- ApplicationController
- Decidim::PrivateDownloadsController
- Defined in:
- app/controllers/decidim/private_downloads_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Methods included from UserBlockedChecker
#check_user_block_status, #check_user_not_blocked
Methods included from NeedsSnippets
Methods included from Headers::HttpCachingDisabler
Methods included from HasStoredPath
#skip_store_location?, #store_current_location
Methods included from TranslatableAttributes
#attachment?, #default_locale?
Methods included from RegistersPermissions
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#show ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/decidim/private_downloads_controller.rb', line 7 def show return head :not_found unless private_download.attached? return head :not_found unless private_download.(current_user) disposition = private_download..content_type.start_with?("image/") ? :inline : :attachment send_data( private_download..download, filename: private_download..filename.to_s, type: private_download..content_type, disposition: ) rescue Decidim::PrivateDownload::InvalidTokenError head :not_found end |