diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-05-09 17:27:26 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-05-09 18:03:03 +0200 |
commit | 9d799ccacfbdfa0ac0f3e7c9477d7040d471dd47 (patch) | |
tree | c2bc8ee1d9f5ae703073fb44bb9ed037fa42f5a8 /config | |
parent | 1802954b4785fa3d6bd3686f5b6de3094a2eb851 (diff) | |
download | gitlab-ce-9d799ccacfbdfa0ac0f3e7c9477d7040d471dd47.tar.gz |
Fix finding wiki pages when they have invalidly-encoded content
Fixes #43715
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 |