Commit 873cc54a authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '18308-escape-characters' into 'master'

Escape characters in git user name

Closes #18308

See merge request !14020
parents c4a1c2ff 528f90b4
...@@ -320,7 +320,7 @@ module ProjectsHelper ...@@ -320,7 +320,7 @@ module ProjectsHelper
def git_user_name def git_user_name
if current_user if current_user
current_user.name current_user.name.gsub('"', '\"')
else else
_("Your name") _("Your name")
end end
......
---
title: Escape quotes in git username
merge_request: 14020
author: Brandon Everett
type: fixed
...@@ -469,4 +469,15 @@ describe ProjectsHelper do ...@@ -469,4 +469,15 @@ describe ProjectsHelper do
expect(recorder.count).to eq(1) expect(recorder.count).to eq(1)
end end
end end
describe '#git_user_name' do
let(:user) { double(:user, name: 'John "A" Doe53') }
before do
allow(helper).to receive(:current_user).and_return(user)
end
it 'parses quotes in name' do
expect(helper.send(:git_user_name)).to eq('John \"A\" Doe53')
end
end
end end
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