Welcome to mirror list, hosted at ThFree Co, Russian Federation.

safe_file.rb « types « validations « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 53b5790bfa21d4c6dd5dc4a9ef416f6ab62fdb42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

# This module overrides the Grape type validator defined in
# https://github.com/ruby-grape/grape/blob/master/lib/grape/validations/types/file.rb
module API
  module Validations
    module Types
      class SafeFile < ::Grape::Validations::Types::File
        def value_coerced?(value)
          super && value[:tempfile].is_a?(Tempfile)
        end
      end
    end
  end
end