debian-mirror-gitlab/lib/api/helpers/file_upload_helpers.rb
2020-03-09 13:42:32 +05:30

15 lines
328 B
Ruby

# frozen_string_literal: true
module API
module Helpers
module FileUploadHelpers
def file_is_valid?
params[:file] && params[:file]['tempfile'].respond_to?(:read)
end
def validate_file!
render_api_error!('Uploaded file is invalid', 400) unless file_is_valid?
end
end
end
end