Commit 3095ac0c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Make internal api work with full repo path instead of name

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent b5797168
...@@ -17,15 +17,25 @@ module API ...@@ -17,15 +17,25 @@ module API
# #
helpers do 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? def wiki?
@wiki ||= params[:project].end_with?('.wiki') && @wiki ||= project_path.end_with?('.wiki') &&
!Project.find_with_namespace(params[:project]) !Project.find_with_namespace(project_path)
end end
def project def project
@project ||= begin @project ||= begin
project_path = params[:project]
# Check for *.wiki repositories. # Check for *.wiki repositories.
# Strip out the .wiki from the pathname before finding the # Strip out the .wiki from the pathname before finding the
# project. This applies the correct project permissions to # project. This applies the correct project permissions to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment