From 33aed43e9db41a9e482beb5e47800de8d6efbe31 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Tue, 30 May 2017 15:05:52 +0000 Subject: Avoid crash when trying to parse string with invalid UTF-8 sequence --- app/validators/dynamic_path_validator.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/validators') 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 -- cgit v1.2.1