summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-27 12:51:57 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-27 16:54:48 +0300
commit3095ac0ca45b044f2055cbd44654c83891245928 (patch)
tree2ac47aca43fc76efb3ee2b31da712ad93620606f
parentb5797168ec529c179342b8c292c2b52f0cbe41ee (diff)
downloadgitlab-ce-3095ac0ca45b044f2055cbd44654c83891245928.tar.gz
Make internal api work with full repo path instead of name
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--lib/api/internal.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 9a5d1ece070..8b5d2259b45 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -17,15 +17,25 @@ module API
#
helpers do
+ def project_path
+ @project_path ||= begin
+ project_path = params[:project].sub(/\.git\z/, '')
+
+ Gitlab.config.repositories.storages.each do |_, storage_path|
+ project_path.sub!(storage_path, '')
+ end
+
+ 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