Skip to content

Commit

Permalink
Force download of attachments (#1490)
Browse files Browse the repository at this point in the history
* Rubocop fix

* resolve merge

* restore gemfile

* restore nl
  • Loading branch information
fanpu committed Apr 10, 2022
1 parent 5a40f80 commit 02d76ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/attachments_controller.rb
Expand Up @@ -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
Expand Down

0 comments on commit 02d76ab

Please sign in to comment.