diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2017-10-20 16:44:30 +0000 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2017-10-20 19:56:39 +0300 |
commit | 1652288f65547e352f50312d2457dffd20db423c (patch) | |
tree | 59c4de90489d7577978b5adc4e41ba833ea55522 /app | |
parent | a0fc7c48226cd54715029a0cc2ad45335fee384a (diff) | |
download | gitlab-ce-1652288f65547e352f50312d2457dffd20db423c.tar.gz |
Merge branch 'tc-page-title-encoding-fix' into 'master'
URI decode Page-Title header to preserve UTF-8 characters
Closes #39179
(cherry-picked from 85c201603ab856fbe5129aa231ab069ffd73d769)
See merge request gitlab-org/gitlab-ce!14929
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/repo/helpers/repo_helper.js | 2 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/assets/javascripts/repo/helpers/repo_helper.js b/app/assets/javascripts/repo/helpers/repo_helper.js index 7483f8bc305..df9fe6b8555 100644 --- a/app/assets/javascripts/repo/helpers/repo_helper.js +++ b/app/assets/javascripts/repo/helpers/repo_helper.js @@ -135,7 +135,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']); Store.isTree = RepoHelper.isTree(data); if (!Store.isTree) { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 967fe39256a..391a0519195 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 |