diff options
author | Simon Knox <psimyn@gmail.com> | 2018-02-07 20:05:38 +1100 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2018-02-07 20:05:38 +1100 |
commit | 4e91d397833eb10e9eb64a48387c441be2922dfb (patch) | |
tree | 079cbe95e6b0ac773987dd2ccedb98b1ded9681b /lib/api/helpers/internal_helpers.rb | |
parent | b68e473e7bb2b64e1a36c54f9ced10ffe5a96763 (diff) | |
parent | 4457cf9d178dc9912fd9c16427ad81b389179d00 (diff) | |
download | gitlab-ce-snake-case.tar.gz |
Merge branch 'master' into snake-casesnake-case
Diffstat (limited to 'lib/api/helpers/internal_helpers.rb')
-rw-r--r-- | lib/api/helpers/internal_helpers.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index eb67de81a0d..cd59da6fc70 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -60,8 +60,20 @@ module API false end + def project_path + project&.path || project_path_match[:project_path] + end + + def namespace_path + project&.namespace&.full_path || project_path_match[:namespace_path] + end + private + def project_path_match + @project_path_match ||= params[:project].match(Gitlab::PathRegex.full_project_git_path_regex) || {} + end + # rubocop:disable Gitlab/ModuleWithInstanceVariables def set_project if params[:gl_repository] |