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.authorized_for?(current_user)
disposition = private_download.attachment.content_type.start_with?("image/") ? :inline : :attachment
send_data(
private_download.attachment.download,
filename: private_download.attachment.filename.to_s,
type: private_download.attachment.content_type,
disposition:
)
rescue Decidim::PrivateDownload::InvalidTokenError
head :not_found
end
|