fix auto open pdf file 2026
This commit is contained in:
parent
07e361d4ae
commit
ee713e442d
|
|
@ -231,7 +231,11 @@ class ArchivesController < ApplicationController
|
||||||
else
|
else
|
||||||
user_agent = request.user_agent.downcase
|
user_agent = request.user_agent.downcase
|
||||||
@escaped_file_name = user_agent.match(/(msie|trident)/) ? CGI::escape(@filename) : @filename
|
@escaped_file_name = user_agent.match(/(msie|trident)/) ? CGI::escape(@filename) : @filename
|
||||||
send_file(@path, :type=>"application/octet-stream", :filename => @escaped_file_name, :x_sendfile=> true)
|
if @ext == "pdf"
|
||||||
|
send_file(@path, :type => "application/pdf", :disposition => "inline", :filename => @escaped_file_name, :x_sendfile => true)
|
||||||
|
else
|
||||||
|
send_file(@path, :type => "application/octet-stream", :filename => @escaped_file_name, :x_sendfile => true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
rescue
|
rescue
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue