summaryrefslogtreecommitdiff
path: root/lib/api/helpers
diff options
context:
space:
mode:
authorMark Fletcher <mark@gitlab.com>2018-02-07 11:42:28 +0000
committerMark Fletcher <mark@gitlab.com>2018-02-07 11:42:28 +0000
commit7a6e88263c922f44e498cd75edd3e4bb1f7469fc (patch)
tree52780aecc48268bc14182bf54a41c12b5606c6d4 /lib/api/helpers
parenta674e131ee35b5e11d0c6eee6c00372b7d232d6d (diff)
parentbbbc815a763e5e6fa4fddd72c702445a2a86880a (diff)
downloadgitlab-ce-7a6e88263c922f44e498cd75edd3e4bb1f7469fc.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'lib/api/helpers')
-rw-r--r--lib/api/helpers/internal_helpers.rb12
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]