From e5ec1af383544c925c8623ed9536b3c454701c3b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 6 Feb 2020 22:51:27 +0800 Subject: [PATCH 1/2] 1 --- app/controllers/attachments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 107932cd8..fd2226b1f 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -22,7 +22,7 @@ class AttachmentsController < ApplicationController send_file absolute_path(local_path(@file)),filename: @file.title, disposition: 'inline',type: 'application/pdf' elsif type_attachment == "MP4" response.header["Accept-Ranges"] = "bytes" - send_file absolute_path(local_path(@file)),filename: @file.title,type: @file.content_type.presence || 'application/octet-stream', status: 206 + send_file absolute_path(local_path(@file)),filename: @file.title, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream' else send_file(absolute_path(local_path(@file)), filename: @file.title,stream:false, type: @file.content_type.presence || 'application/octet-stream') end From 49d93fb6aa0818bac8cb2b7b73dbd9172ba8ca4e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 6 Feb 2020 22:55:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 fd2226b1f..2485c44a7 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -22,7 +22,8 @@ class AttachmentsController < ApplicationController send_file absolute_path(local_path(@file)),filename: @file.title, disposition: 'inline',type: 'application/pdf' elsif type_attachment == "MP4" response.header["Accept-Ranges"] = "bytes" - send_file absolute_path(local_path(@file)),filename: @file.title, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream' + send_file absolute_path(local_path(@file)),filename: @file.title, disposition: 'inline', + type: @file.content_type.presence || 'application/octet-stream', x_sendfile: true else send_file(absolute_path(local_path(@file)), filename: @file.title,stream:false, type: @file.content_type.presence || 'application/octet-stream') end