diff options
author | Robert Speicher <robert@gitlab.com> | 2018-05-10 17:47:04 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-05-10 19:39:49 +0300 |
commit | bd581a35c204444344b611cea33fbf6273feeaa8 (patch) | |
tree | f8c2ba14be41e182bb4d25c6c4162dfccf811944 /config | |
parent | 6657e65dd1470fdcb92870fcd9711fa220d1e0a5 (diff) |
Merge branch 'fix/wiki-find-page-invalid-encoding' into 'master'
Fix finding wiki pages when they have invalidly-encoded content
Closes #43715
See merge request gitlab-org/gitlab-ce!18856
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/gollum.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/config/initializers/gollum.rb b/config/initializers/gollum.rb index 81e0577a7c9..ea9cc151a57 100644 --- a/config/initializers/gollum.rb +++ b/config/initializers/gollum.rb @@ -7,6 +7,20 @@ module Gollum end require "gollum-lib" +module Gollum + class Page + def text_data(encoding = nil) + data = if raw_data.respond_to?(:encoding) + raw_data.force_encoding(encoding || Encoding::UTF_8) + else + raw_data + end + + Gitlab::EncodingHelper.encode!(data) + end + end +end + Rails.application.configure do config.after_initialize do Gollum::Page.per_page = Kaminari.config.default_per_page |