summaryrefslogtreecommitdiff
path: root/lib/api/validations/types/workhorse_file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/validations/types/workhorse_file.rb')
-rw-r--r--lib/api/validations/types/workhorse_file.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/validations/types/workhorse_file.rb b/lib/api/validations/types/workhorse_file.rb
new file mode 100644
index 00000000000..18d111f6556
--- /dev/null
+++ b/lib/api/validations/types/workhorse_file.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+module API
+ module Validations
+ module Types
+ class WorkhorseFile < Virtus::Attribute
+ def coerce(input)
+ # Processing of multipart file objects
+ # is already taken care of by Gitlab::Middleware::Multipart.
+ # Nothing to do here.
+ input
+ end
+
+ def value_coerced?(value)
+ value.is_a?(::UploadedFile)
+ end
+ end
+ end
+ end
+end