1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/controllers/api/files_controller.rb
2023-03-22 10:58:22 +01:00

21 lines
436 B
Ruby

# frozen_string_literal: true
# API Controller for handling special actions on files
class API::FilesController < API::APIController
before_action :authenticate_user!
# test the mime type of the uploaded file
def mime
authorize :file
content_type = Marcel::MimeType.for Pathname.new(file_params.path)
render json: { type: content_type }
end
private
def file_params
params.require(:attachment)
end
end