diff options
author | Brett Walker <bwalker@gitlab.com> | 2019-02-20 17:51:55 -0600 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2019-08-23 23:44:53 -0500 |
commit | ad05e488636ebe05b4985dbf3c7d912fd8d56f49 (patch) | |
tree | 427b631b34fa8ed7511f3ed789185cd82a1a6da9 /lib/api/validations | |
parent | 892e4c0da818006159cc26bc79f1fa48b76c9b3f (diff) | |
download | gitlab-ce-ad05e488636ebe05b4985dbf3c7d912fd8d56f49.tar.gz |
Add support for using a Camo proxy server
User images and videos will get proxied through
the Camo server in order to keep malicious
sites from collecting the IP address of users.
Diffstat (limited to 'lib/api/validations')
-rw-r--r-- | lib/api/validations/types/comma_separated_to_array.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/api/validations/types/comma_separated_to_array.rb b/lib/api/validations/types/comma_separated_to_array.rb new file mode 100644 index 00000000000..b551878abd1 --- /dev/null +++ b/lib/api/validations/types/comma_separated_to_array.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module API + module Validations + module Types + class CommaSeparatedToArray + def self.coerce + lambda do |value| + case value + when String + value.split(',').map(&:strip) + when Array + value.map { |v| v.to_s.split(',').map(&:strip) }.flatten + else + [] + end + end + end + end + end + end +end |