summaryrefslogtreecommitdiffstats
path: root/app/models/wiki_content.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-06 07:21:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-06 07:21:51 +0000
commitf1cae4f7af77a21af778c376fe01f709d89c2b70 (patch)
tree43ad8c2930039b9102be1200ab3c597d885c6745 /app/models/wiki_content.rb
parente964135b625a27652bba6ef523c4cc0c9d4ffbd6 (diff)
downloadredmine-f1cae4f7af77a21af778c376fe01f709d89c2b70.tar.gz
redmine-f1cae4f7af77a21af778c376fe01f709d89c2b70.zip
WikiContent::Version#text may return ascii-8bit encoded string (#10590).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9329 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/wiki_content.rb')
-rw-r--r--app/models/wiki_content.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb
index 1bbdf09cb..1787a7898 100644
--- a/app/models/wiki_content.rb
+++ b/app/models/wiki_content.rb
@@ -91,14 +91,16 @@ class WikiContent < ActiveRecord::Base
end
def text
- @text ||= case compression
- when 'gzip'
- str = Zlib::Inflate.inflate(data)
+ @text ||= begin
+ str = case compression
+ when 'gzip'
+ Zlib::Inflate.inflate(data)
+ else
+ # uncompressed data
+ data
+ end
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
str
- else
- # uncompressed data
- data
end
end