Class: Dscf::Core::FilesController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Dscf::Core::FilesController
- Includes:
- FileUploadable
- Defined in:
- app/controllers/dscf/core/files_controller.rb
Overview
Controller for serving file attachments from MinIO storage Provides download endpoints for files uploaded via the Attachable concern
Instance Method Summary collapse
-
#show ⇒ Object
GET /dscf/core/files/:file_key Serves a file from MinIO storage.
Methods included from FileUploadable
#after_save_hook, #attach_files, #auto_attach_files, #file_upload_strict_mode?, #process_base64_file, #send_attachment, #send_stored_file, #upload_base64_file, #upload_file, #upload_files
Methods included from Authorizable
#authorize, #authorize_action!, #policy_scope, #pundit_user
Methods included from JsonResponse
#render_error, #render_success, #serialize
Methods included from TokenAuthenticatable
#require_valid_refresh_token, #validate_device_consistency, #validate_token_expiry
Methods included from Authenticatable
#authenticate_user, #authenticate_user!, #current_user, #refresh_token, #sign_in, #sign_out
Instance Method Details
#show ⇒ Object
GET /dscf/core/files/:file_key Serves a file from MinIO storage
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/dscf/core/files_controller.rb', line 21 def show = FileAttachment.find_by(file_key: params[:file_key]) unless render json: {success: false, error: "File not found"}, status: :not_found return end disposition = params[:download].present? ? "attachment" : "inline" ( , disposition: disposition ) end |