summaryrefslogtreecommitdiff
path: root/app/services/files/create_dir_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/files/create_dir_service.rb')
-rw-r--r--app/services/files/create_dir_service.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/services/files/create_dir_service.rb b/app/services/files/create_dir_service.rb
index 71272fb5707..6107254a34e 100644
--- a/app/services/files/create_dir_service.rb
+++ b/app/services/files/create_dir_service.rb
@@ -5,5 +5,16 @@ module Files
def commit
repository.commit_dir(current_user, @file_path, @commit_message, @target_branch)
end
+
+ def validate
+ super
+
+ unless @file_path =~ Gitlab::Regex.file_path_regex
+ raise_error(
+ 'Your changes could not be committed, because the file path ' +
+ Gitlab::Regex.file_path_regex_message
+ )
+ end
+ end
end
end