files mimetype fix
This commit is contained in:
@@ -5,7 +5,10 @@ class FilesController < ApplicationController
|
||||
result = FileService.new.show(FileShowInput.new(path: params[:path]))
|
||||
case result.type
|
||||
when :redirect then redirect_to result.url, status: :moved_permanently
|
||||
when :file then send_file result.path, disposition: "inline"
|
||||
when :file
|
||||
ext = File.extname(result.path.to_s).delete_prefix(".")
|
||||
mime = Mime::Type.lookup_by_extension(ext) || "application/octet-stream"
|
||||
send_file result.path, disposition: "inline", type: mime
|
||||
when :not_found then head :not_found
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user