diff --git a/apps/api/app/controllers/files_controller.rb b/apps/api/app/controllers/files_controller.rb index 0ba718f..e173f0f 100644 --- a/apps/api/app/controllers/files_controller.rb +++ b/apps/api/app/controllers/files_controller.rb @@ -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