Skip to content
Snippets Groups Projects
Commit da18211f authored by Stan Hu's avatar Stan Hu
Browse files

Fix Error 500 when user commits Wiki page with no commit message

Previously if a user submitted a blank commit message, Gitaly would
error out with `3:WikiWritePage: empty CommitDetails.Message` since
Gitaly checks whether any content is present for the message. We now
use a default commit message if a user leaves it blank.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/59065
parent 250f6ad2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -183,7 +183,7 @@ class ProjectWiki
end
 
def commit_details(action, message = nil, title = nil)
commit_message = message || default_message(action, title)
commit_message = message.presence || default_message(action, title)
git_user = Gitlab::Git::User.from_gitlab(@user)
 
Gitlab::Git::Wiki::CommitDetails.new(@user.id,
Loading
Loading
---
title: Fix Error 500 when user commits Wiki page with no commit message
merge_request: 26247
author:
type: fixed
Loading
Loading
@@ -71,6 +71,14 @@ describe ProjectWiki do
expect(project_wiki.create_page("index", "test content")).to be_truthy
end
 
it "creates a new wiki repo with a default commit message" do
expect(project_wiki.create_page("index", "test content", :markdown, "")).to be_truthy
page = project_wiki.find_page('index')
expect(page.last_version.message).to eq("#{user.username} created page: index")
end
it "raises CouldNotCreateWikiError if it can't create the wiki repository" do
# Create a fresh project which will not have a wiki
project_wiki = described_class.new(create(:project), user)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment