summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-10-29 15:50:49 +0100
committerDouwe Maan <douwe@gitlab.com>2015-10-29 15:50:49 +0100
commit0ea38dc519b86d2bd2e14f1df1baf0fffc043af6 (patch)
tree8dc3643e810cb4e272cb767337b212782e2f5976 /lib
parentf24324adbea1f7df20e77647b1df7085cba51a95 (diff)
parent6d0337a97a9d21a27bdd96b48ae17d2458b4ad46 (diff)
downloadgitlab-ce-0ea38dc519b86d2bd2e14f1df1baf0fffc043af6.tar.gz
Merge branch 'binford2k/gitlab-ce-feature/create_new_directories'
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/regex.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 9f1adc860d1..53ab2686b43 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -51,6 +51,23 @@ module Gitlab
"can contain only letters, digits, '_', '-' and '.'. "
end
+ def file_path_regex
+ @file_path_regex ||= /\A[a-zA-Z0-9_\-\.\/]*\z/.freeze
+ end
+
+ def file_path_regex_message
+ "can contain only letters, digits, '_', '-' and '.'. Separate directories with a '/'. "
+ end
+
+
+ def directory_traversal_regex
+ @directory_traversal_regex ||= /\.{2}/.freeze
+ end
+
+ def directory_traversal_regex_message
+ "cannot include directory traversal. "
+ end
+
def archive_formats_regex
# |zip|tar| tar.gz | tar.bz2 |