Skip to content

Commit

Permalink
Fixes broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
HazelGrant committed Mar 28, 2024
1 parent 7cf0547 commit c7c7af5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apps/dashboard/app/controllers/files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@ def edit

private

# See: https://github.com/OSC/ondemand/pull/3467#discussion_r1541521249
def send_stream(filename:, disposition: "attachment", type: nil)
response.headers["Content-Type"] =
(type.is_a?(Symbol) ? Mime[type].to_s : type) ||
Mime::Type.lookup_by_extension(File.extname(filename).downcase.delete("."))&.to_s ||
"application/octet-stream"

response.headers["Content-Disposition"] =
ActionDispatch::Http::ContentDisposition.format(disposition: disposition, filename: filename)

yield response.stream
ensure
response.stream.close
end

# set these headers to nil so that we (Rails) will read files
# off of disk instead of nginx.
def strip_sendfile_headers
Expand Down

0 comments on commit c7c7af5

Please sign in to comment.