summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-28 21:36:40 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-28 21:36:40 +0000
commitb7d3fc15a45a7f3ca0a293a23edf7e74ad80aa78 (patch)
treec6c540ad4f32f5269caa3de512d0670b7929d92d /lib
parentc8ad9fec22d28d23b9b26c3d11b202ae28b70905 (diff)
parent440604ad1ba67dcbdd23633765b9140fae4bd4b9 (diff)
downloadgitlab-ce-b7d3fc15a45a7f3ca0a293a23edf7e74ad80aa78.tar.gz
Merge branch 'dz-internal-api-fullpath' into 'master'
Make internal api work with full repo path and name ## What does this MR do? Make internal api work with full repo path and name ## Why was this MR needed? So we can pass full repository path on filesystem from gitlab-shell instead of extracted one. We need this for nested groups support where project is can be nested under several groups. ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/2772 See merge request !7148
Diffstat (limited to 'lib')
-rw-r--r--lib/api/internal.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 9a5d1ece070..ccf181402f9 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -17,15 +17,20 @@ module API
#
helpers do
+ def project_path
+ @project_path ||= begin
+ project_path = params[:project].sub(/\.git\z/, '')
+ Repository.remove_storage_from_path(project_path)
+ end
+ end
+
def wiki?
- @wiki ||= params[:project].end_with?('.wiki') &&
- !Project.find_with_namespace(params[:project])
+ @wiki ||= project_path.end_with?('.wiki') &&
+ !Project.find_with_namespace(project_path)
end
def project
@project ||= begin
- project_path = params[:project]
-
# Check for *.wiki repositories.
# Strip out the .wiki from the pathname before finding the
# project. This applies the correct project permissions to