BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f846abdb
Commit
f846abdb
authored
Oct 20, 2017
by
Toon Claes
Committed by
Winnie Hellmann
Oct 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URI decode Page-Title header to preserve UTF-8 characters
parent
0715fa63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+1
-1
application_controller.rb
app/controllers/application_controller.rb
+1
-1
application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+14
-0
No files found.
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
f846abdb
...
...
@@ -95,7 +95,7 @@ const RepoHelper = {
return
Service
.
getContent
()
.
then
((
response
)
=>
{
const
data
=
response
.
data
;
if
(
response
.
headers
&&
response
.
headers
[
'page-title'
])
data
.
pageTitle
=
response
.
headers
[
'page-title'
]
;
if
(
response
.
headers
&&
response
.
headers
[
'page-title'
])
data
.
pageTitle
=
decodeURI
(
response
.
headers
[
'page-title'
])
;
if
(
response
.
headers
&&
response
.
headers
[
'is-root'
]
&&
!
Store
.
isInitialRoot
)
{
Store
.
isRoot
=
convertPermissionToBoolean
(
response
.
headers
[
'is-root'
]);
Store
.
isInitialRoot
=
Store
.
isRoot
;
...
...
app/controllers/application_controller.rb
View file @
f846abdb
...
...
@@ -349,6 +349,6 @@ class ApplicationController < ActionController::Base
def
set_page_title_header
# Per https://tools.ietf.org/html/rfc5987, headers need to be ISO-8859-1, not UTF-8
response
.
headers
[
'Page-Title'
]
=
page_title
(
'GitLab'
).
encode
(
'ISO-8859-1'
)
response
.
headers
[
'Page-Title'
]
=
URI
.
escape
(
page_title
(
'GitLab'
)
)
end
end
spec/controllers/application_controller_spec.rb
View file @
f846abdb
...
...
@@ -221,6 +221,20 @@ describe ApplicationController do
end
end
describe
'#set_page_title_header'
do
let
(
:controller
)
{
described_class
.
new
}
it
'URI encodes UTF-8 characters in the title'
do
response
=
double
(
headers:
{})
allow_any_instance_of
(
PageLayoutHelper
).
to
receive
(
:page_title
).
and_return
(
'€100 · GitLab'
)
allow
(
controller
).
to
receive
(
:response
).
and_return
(
response
)
controller
.
send
(
:set_page_title_header
)
expect
(
response
.
headers
[
'Page-Title'
]).
to
eq
(
'%E2%82%AC100%20%C2%B7%20GitLab'
)
end
end
context
'two-factor authentication'
do
let
(
:controller
)
{
described_class
.
new
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment