fix download

This commit is contained in:
rulingcom 2025-04-21 19:18:04 +08:00
parent e459d8e828
commit 2f99e39bf2
1 changed files with 4 additions and 4 deletions

View File

@ -333,9 +333,9 @@ class UniversalTablesController < ApplicationController
@path = file.file.file.file rescue ""
@filename = File.basename(@path)
@ext = @filename.split(".").last
if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf"
render "download_file",:layout=>false
else
# if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf"
# render "download_file",:layout=>false
# else
if (current_site.accessibility_mode rescue false)
render "redirect_to_file",:layout=>false
else
@ -343,7 +343,7 @@ class UniversalTablesController < ApplicationController
@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)
end
end
# end
rescue
redirect_to @url
end