Skip to content

Commit

Permalink
set 'content-length' header when sending files (#3653)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashton22305 authored Jul 1, 2024
1 parent d33e3a2 commit d320f07
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/dashboard/app/controllers/files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ def show_file
def send_posix_file
type = Files.mime_type_by_extension(@path).presence || PosixFile.new(@path).mime_type

response.set_header 'Content-Length', @path.stat.size

# svgs aren't safe to view until we update our CSP
if download? || type.to_s == 'image/svg+xml'
type = 'text/plain; charset=utf-8' if type.to_s == 'image/svg+xml'
Expand Down

0 comments on commit d320f07

Please sign in to comment.