diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2019-01-09 16:55:29 +0800 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-01-31 16:51:16 +0100 |
commit | 219d24fe5298f6ca5a16d4392360fe1f691aee97 (patch) | |
tree | 54038050e7e813a006f1a1e546e41aadbaa9e2d5 /lib/gitlab/path_regex.rb | |
parent | 68d13322290a52360cd485d24bcfff995d98cf97 (diff) | |
download | gitlab-ce-219d24fe5298f6ca5a16d4392360fe1f691aee97.tar.gz |
Fix slow project reference pattern regex
Diffstat (limited to 'lib/gitlab/path_regex.rb')
-rw-r--r-- | lib/gitlab/path_regex.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/path_regex.rb b/lib/gitlab/path_regex.rb index fa68dead80b..3c888be0710 100644 --- a/lib/gitlab/path_regex.rb +++ b/lib/gitlab/path_regex.rb @@ -125,7 +125,8 @@ module Gitlab # allow non-regex validations, etc), `NAMESPACE_FORMAT_REGEX_JS` serves as a Javascript-compatible version of # `NAMESPACE_FORMAT_REGEX`, with the negative lookbehind assertion removed. This means that the client-side validation # will pass for usernames ending in `.atom` and `.git`, but will be caught by the server-side validation. - PATH_REGEX_STR = '[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*'.freeze + PATH_START_CHAR = '[a-zA-Z0-9_\.]'.freeze + PATH_REGEX_STR = PATH_START_CHAR + '[a-zA-Z0-9_\-\.]*'.freeze NAMESPACE_FORMAT_REGEX_JS = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze NO_SUFFIX_REGEX = /(?<!\.git|\.atom)/.freeze |