summaryrefslogtreecommitdiff
path: root/app/validators
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-05-30 15:05:52 +0000
committerDouwe Maan <douwe@gitlab.com>2017-05-30 15:05:52 +0000
commit33aed43e9db41a9e482beb5e47800de8d6efbe31 (patch)
treefe2011a68623ba6e2c8ffa2ae2dbc128fe4286dd /app/validators
parent374486fb2e1d51a059490a375d7fcd7aca4f65b8 (diff)
downloadgitlab-ce-33aed43e9db41a9e482beb5e47800de8d6efbe31.tar.gz
Avoid crash when trying to parse string with invalid UTF-8 sequence
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/dynamic_path_validator.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/validators/dynamic_path_validator.rb b/app/validators/dynamic_path_validator.rb
index 6819886ebf4..a9b76c7c960 100644
--- a/app/validators/dynamic_path_validator.rb
+++ b/app/validators/dynamic_path_validator.rb
@@ -6,16 +6,21 @@
# Values are checked for formatting and exclusion from a list of illegal path
# names.
class DynamicPathValidator < ActiveModel::EachValidator
+ extend Gitlab::Git::EncodingHelper
+
class << self
def valid_user_path?(path)
+ encode!(path)
"#{path}/" =~ Gitlab::PathRegex.root_namespace_path_regex
end
def valid_group_path?(path)
+ encode!(path)
"#{path}/" =~ Gitlab::PathRegex.full_namespace_path_regex
end
def valid_project_path?(path)
+ encode!(path)
"#{path}/" =~ Gitlab::PathRegex.full_project_path_regex
end
end