Unescape HTML characters in Wiki title
The special characters of a wiki title are now escaped correctly.
This commit is contained in:
parent
f35d7d7f6e
commit
378ee1dac2
3 changed files with 12 additions and 1 deletions
|
@ -84,7 +84,7 @@ class WikiPage
|
||||||
# The formatted title of this page.
|
# The formatted title of this page.
|
||||||
def title
|
def title
|
||||||
if @attributes[:title]
|
if @attributes[:title]
|
||||||
self.class.unhyphenize(@attributes[:title])
|
CGI.unescape_html(self.class.unhyphenize(@attributes[:title]))
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
end
|
end
|
||||||
|
|
5
changelogs/unreleased/35686-unescape-wiki-title.yml
Normal file
5
changelogs/unreleased/35686-unescape-wiki-title.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Unescape HTML characters in Wiki title
|
||||||
|
merge_request: 13942
|
||||||
|
author: Jacopo Beschi @jacopo-beschi
|
||||||
|
type: fixed
|
|
@ -281,6 +281,12 @@ describe WikiPage do
|
||||||
@page.title = "Import-existing-repositories-into-GitLab"
|
@page.title = "Import-existing-repositories-into-GitLab"
|
||||||
expect(@page.title).to eq("Import existing repositories into GitLab")
|
expect(@page.title).to eq("Import existing repositories into GitLab")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'unescapes html' do
|
||||||
|
@page.title = 'foo & bar'
|
||||||
|
|
||||||
|
expect(@page.title).to eq('foo & bar')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#directory' do
|
describe '#directory' do
|
||||||
|
|
Loading…
Reference in a new issue