Commit d3779489 authored by James Lopez's avatar James Lopez

fix for projects ending in .wiki

parent d74cfe7d
...@@ -14,6 +14,14 @@ module API ...@@ -14,6 +14,14 @@ module API
# ref - branch name # ref - branch name
# forced_push - forced_push # forced_push - forced_push
# #
helpers do
def wiki
@wiki ||= params[:project].end_with?('.wiki') &&
!Project.find_with_namespace(params[:project])
end
end
post "/allowed" do post "/allowed" do
status 200 status 200
...@@ -30,7 +38,6 @@ module API ...@@ -30,7 +38,6 @@ module API
# 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
# the wiki repository as well. # the wiki repository as well.
wiki = project_path.end_with?('.wiki')
project_path.chomp!('.wiki') if wiki project_path.chomp!('.wiki') if wiki
project = Project.find_with_namespace(project_path) project = Project.find_with_namespace(project_path)
......
...@@ -54,6 +54,16 @@ describe API::API, api: true do ...@@ -54,6 +54,16 @@ describe API::API, api: true do
project.team << [user, :developer] project.team << [user, :developer]
end end
context "git push with project.wiki" do
let(:project) { create(:project, name: 'my.wiki', path: 'my.wiki') }
it do
push(key, project)
expect(response.status).to eq(200)
expect(json_response["status"]).to be_truthy
end
end
context "git pull" do context "git pull" do
it do it do
pull(key, project) pull(key, project)
......
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