BigW Consortium Gitlab

Commit edf5e9eb by Robert Speicher

Merge branch 'fix/project-wiki-ending' into 'master'

Fix for project paths ending in .wiki This prevents `Git operation was rejected by pre-receive hook` when an actual project ending with .wiki is thought to be a wiki by the `Internal` API. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/13742 See merge request !2960
parents 6f85eb38 3ac202c3
......@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.6.0 (unreleased)
- Improve the formatting for the user page bio (Connor Shea)
- Fix issue when pushing to projects ending in .wiki
- Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
- Strip leading and trailing spaces in URL validator (evuez)
- Update documentation to reflect Guest role not being enforced on internal projects
......
......@@ -14,6 +14,14 @@ module API
# ref - branch name
# 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
status 200
......@@ -30,13 +38,12 @@ module API
# Strip out the .wiki from the pathname before finding the
# project. This applies the correct project permissions to
# 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)
access =
if wiki
if wiki?
Gitlab::GitAccessWiki.new(actor, project)
else
Gitlab::GitAccess.new(actor, project)
......
......@@ -54,6 +54,18 @@ describe API::API, api: true do
project.team << [user, :developer]
end
context "git push with project.wiki" do
it 'responds with success' do
project_wiki = create(:project, name: 'my.wiki', path: 'my.wiki')
project_wiki.team << [user, :developer]
push(key, project_wiki)
expect(response.status).to eq(200)
expect(json_response["status"]).to be_truthy
end
end
context "git pull" do
it do
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