From 02d76ab3737689bba95ffe9a1c69ca5166d71c6b Mon Sep 17 00:00:00 2001 From: Fan Pu Date: Sun, 10 Apr 2022 16:52:02 -0400 Subject: [PATCH] Force download of attachments (#1490) * Rubocop fix * resolve merge * restore gemfile * restore nl --- app/controllers/attachments_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 0c7e35fdc..a3ae9887d 100755 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -44,8 +44,9 @@ def show flash[:error] = "Error loading #{@attachment.name} from #{@attachment.filename}" redirect_to([@course, :attachments]) && return end + # Set to application/octet-stream to force download send_file(filename, disposition: "inline", - type: @attachment.mime_type, filename: @attachment.filename) && return + type: "application/octet-stream", filename: @attachment.filename) && return end action_auth_level :edit, :instructor