summaryrefslogtreecommitdiff
path: root/lib/api/validations
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-09-02 18:41:18 +0200
committerAlessio Caiazza <acaiazza@gitlab.com>2019-09-06 15:53:13 +0200
commite32069ef6cb569c11e792dadacc4713871325d9d (patch)
treef138987f7499048bdc590436645083add2e9f0ec /lib/api/validations
parent222d9e62f2f88b01542bea0890fb8fba816f83a5 (diff)
downloadgitlab-ce-e32069ef6cb569c11e792dadacc4713871325d9d.tar.gz
Process workhorse accelerated wiki uploads
Wiki attachments can be workhorse accelerated. This commit is backward compatible with older workhorse
Diffstat (limited to 'lib/api/validations')
-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